codedoc-js

1.0.1 • Public • Published

code-doc

A small JS module to copy the content of script tags into code blocks for documentations

usage

Create a div with the id code-doc:

<div id="code-doc"></div>

And add the class doc to each script tag that you want to copy:

<script class="doc">
// Your awesome code
</script>

Then code-doc will populate the div with the content from the script tags.

api

All API methods return the module itself in order to call them with chaining. If you want to have the first line of each code block as a heading, call

codedoc.heading();

Also, if any additional callback should be triggered (such as highlighting after the code blocks are populated), set it with `callback(func)``:

codedoc.callback(func);

This will trigger the function func once the blocks are ready.

To re-run the code generation, simply call

codedoc.run();

Readme

Keywords

none

Package Sidebar

Install

npm i codedoc-js

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

155 kB

Total Files

14

Last publish

Collaborators

  • enys