Plugins

Hidden Comments

nizel-plugin-hidden-comments controls how Markdown HTML comments render. It can keep comments in the generated HTML for copy/PDF workflows, show them as small reviewer notes, render them inline, or remove them entirely.

Install

npm install nizel-plugin-hidden-comments

Usage

import { useNizel } from 'nizel';
import { hiddenCommentsPlugin } from 'nizel-plugin-hidden-comments';

const nizel = useNizel({
  plugins: [hiddenCommentsPlugin({ mode: 'hide' })],
});

const html = await nizel.html('Visible <!-- internal note --> text');

Modes

ModeBehavior
hideRenders a visually hidden span that keeps the comment text copyable and available to PDF text layers.
smallRenders the comment as small muted inline text.
renderRenders the comment inline at the normal text size.
removeRemoves Markdown comments from rendered output.

Reverse Conversion

The plugin also contributes an HTML-to-Markdown handler. Hidden comment spans created by the plugin convert back to Markdown comments:

const markdown = nizel.htmlToMarkdown(html, {
  plugins: [hiddenCommentsPlugin()],
});

nizel-kit automatically wires enabled plugins into reverse conversion, so native apps can round-trip selected hidden-comment output by enabling the hidden-comments plugin ID.

Styling

The plugin does not inject CSS by default. Load the standard style package when using the default class names:

import 'nizel-style/plugins/hidden-comments.css';

For standalone output, pass injectCss: true:

hiddenCommentsPlugin({ injectCss: true });

Options

OptionTypeDefaultDescription
mode`'hide' \'small' \'render' \'remove'`'hide'Controls how comments appear in rendered HTML.
injectCssbooleanfalsePrepends minimal CSS to the generated HTML.
classNamestring'nizel-hidden-comment'Base class used for generated spans.

Browser IIFE: NizelHiddenComments from dist/hidden-comments.iife.js.