gitbook-plugin-js-console

3.2.0 • Public • Published

gitbook-plugin-js-console

GitBook plugin that provide interactive JavaScript console.

Dependencies:

Install

Install with npm:

npm install gitbook-plugin-js-console

Usage

put "js-console" to your book.json

{
  "gitbook": ">=3.0.0",
  "plugins": [
    "js-console"
  ]
}

Add <!-- js-console --> or class="gitbook-plugin-js-console" node before/after of CodeBlock.

<!-- js-console -->
```js
1 + 2;
```

Add <!-- js-console:{ "state": "open" } --> and this console is opened by default.

<!-- js-console:{ "state": "open" } -->
```js
1 + 2;
```

Add <!-- js-console:{ "type": "module" } --> and this console will execute the code as ECMAScript Module.

📝 Current limitation: ES Modules mode does not return value

<!-- js-console:{ "type": "module" } -->
```js
await 1; // Module allow Top-Level await
```

For more details, See website.

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

npm i -d && npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT © azu

Package Sidebar

Install

npm i gitbook-plugin-js-console

Weekly Downloads

123

Version

3.2.0

License

MIT

Unpacked Size

1.44 MB

Total Files

10

Last publish

Collaborators

  • azu