Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@diplodoc/cut-extension

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@diplodoc/cut-extension

Cut extension for Diplodoc platform

  • 0.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
600
increased by116.61%
Maintainers
0
Weekly downloads
 
Created
Source

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: [
        tabsExtension.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/tabs-extension.js' and '_assets/tabs-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/tabs-extension.js

  • runtime.style - name on runtime css file which will be exposed in results style section.
    (Default: _assets/tabs-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

Package last updated on 18 Dec 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc