kubernetes-handbook/node_modules/gitbook-plugin-codesnippet
Jimmy Song c6db5e8fef
add node modules
2021-04-13 00:24:28 +08:00
..
test add node modules 2021-04-13 00:24:28 +08:00
.npmignore add node modules 2021-04-13 00:24:28 +08:00
LICENSE add node modules 2021-04-13 00:24:28 +08:00
README.md add node modules 2021-04-13 00:24:28 +08:00
index.js add node modules 2021-04-13 00:24:28 +08:00
package.json add node modules 2021-04-13 00:24:28 +08:00

README.md

Include code snippets in your GitBook

This plugins makes it easy to import code files or uses variables in codeblocks in your GitBook.

How to use it?

Add it to your book.json configuration:

{
    "plugins": ["codesnippet"]
}

And then in your content:

This is a code snippet:

{% codesnippet "./myfile.js" %}{% endcodesnippet %}

Using a specific language:

This is a code snippet, display as HTML:

{% codesnippet "./myfile.ejs", language="html" %}{% endcodesnippet %}

Include a range of lines:

This is a code snippet, display as HTML:

{% codesnippet "./myfile.ejs", lines="2:5" %}{% endcodesnippet %}

Code blocks with templating syntax:

This is a code snippet, display as HTML:

{% codesnippet %}
curl {{ book.hostname|d("http://localhost") }}/myapi
{% endcodesnippet %}