0.7.4 • Published 11 months ago

@diplodoc/cut-extension v0.7.4

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Diplodoc cut extension

NPM version

This is an extension of the Diplodoc platform, which allows adding collapsible sections in the documentation.

The extension contains some parts:

Quickstart

Attach the plugin to the transformer:

import cutExtension from '@diplodoc/cut-extension';
import transform from '@diplodoc/transform';

const {result} = await transform(`
{% cut "Cut title" %}

Cut content

{% endcut %}
`, {
    plugins: [
        cutExtension.transform({ bundle: false })
    ]
});

Prepared runtime

It is necessary to add runtime scripts to make cuts interactive on your page. You can add assets files which were generated by the MarkdownIt transform plugin.

<html>
    <head>
        <!-- Read more about '_assets/cut-extension.js' and '_assets/cut-extension.css' in 'Transform plugin' section -->
        <script src='_assets/cut-extension.js' async></script>
        <link rel='stylesheet' href='_assets/cut-extension.css' />
    </head>
    <body>
        ${result.html}
    </body>
</html>

Or you can just include runtime's source code in your bundle.

import '@diplodoc/cut-extension/runtime'
import '@diplodoc/cut-extension/runtime/styles.css'

MarkdownIt transform plugin

Plugin for @diplodoc/transform package.

Options:

  • runtime.script - name on runtime script which will be exposed in results script section. Default: _assets/cut-extension.js

  • runtime.style - name on runtime css file which will be exposed in results style section. (Default: _assets/cut-extension.css)

  • bundle - boolean flag to enable/disable copying of bundled runtime to target directory. Where target directore is <transformer output option>/<plugin runtime option> Default: true

0.7.2

1 year ago

0.7.1

1 year ago

0.7.4

11 months ago

0.7.3

1 year ago

0.5.0

1 year ago

0.4.0

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.0

2 years ago

0.2.6-beta4

2 years ago

0.2.6-beta3

2 years ago

0.2.6-beta2

2 years ago

0.2.6-beta

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago