
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@diplodoc/cut-extension
Advanced tools
This is an extension of the Diplodoc platform, which allows adding collapsible sections in the documentation.
The extension contains some parts:
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 })
]
});
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'
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
FAQs
Cut extension for Diplodoc platform
The npm package @diplodoc/cut-extension receives a total of 2,305 weekly downloads. As such, @diplodoc/cut-extension popularity was classified as popular.
We found that @diplodoc/cut-extension demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.