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
| Mode | Behavior |
|---|---|
hide | Renders a visually hidden span that keeps the comment text copyable and available to PDF text layers. |
small | Renders the comment as small muted inline text. |
render | Renders the comment inline at the normal text size. |
remove | Removes 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
| Option | Type | Default | Description | |||
|---|---|---|---|---|---|---|
mode | `'hide' \ | 'small' \ | 'render' \ | 'remove'` | 'hide' | Controls how comments appear in rendered HTML. |
injectCss | boolean | false | Prepends minimal CSS to the generated HTML. | |||
className | string | 'nizel-hidden-comment' | Base class used for generated spans. |
Browser IIFE: NizelHiddenComments from dist/hidden-comments.iife.js.
Plugins
More Pages
-
Alerts
nizel-plugin-alertadds GitHub-style callout blocks for notes, tips, important notices, warnings, and cautions. -
Autolinks
nizel-plugin-autolinkconfigures Nizel's built-in conversion of bare URLs and email addresses into links. -
Code Copy
nizel-plugin-code-copyrenders copy controls for fenced code blocks. -
Definition Lists
nizel-plugin-deflistconverts definition-list syntax into<dl>,<dt>, and<dd>output. -
Emoji
nizel-plugin-emojireplaces known:name:shortcuts with emoji before Markdown is parsed. -
Shiki
nizel-plugin-shikilets Nizel delegate fenced code block rendering to a Worker-compatible highlighter function. -
Task Lists
nizel-plugin-task-listrenders parsed task-list items as checkbox markup. -
Abbreviations
nizel-plugin-abbrrenders abbreviation definitions such as: -
Badge
nizel-plugin-badgerenders compact inline labels with safe tones, aliases, titles, and metadata. -
Citations
nizel-plugin-citationsadds simple citation references and bibliography output. -
Details
nizel-plugin-detailsadds disclosure blocks: -
Diagrams
nizel-plugin-diagramsrenders Mermaid fences as containers for a host Mermaid renderer. -
Footnotes
nizel-plugin-footnotesrenders[^id]references and definitions. -
Frontmatter UI
nizel-plugin-frontmatter-uiprovides helpers for rendering metadata as UI. Core Nizel already parses frontmatter; this plugin is for display. -
GFM Preset
nizel-plugin-gfmis a convenience preset for GFM-oriented companion plugins. Core Nizel already includes GFM-like tables, task list metadata, strikethrough, and autolinks. -
Heading Anchors
nizel-plugin-heading-anchorsappends visible anchor links to headings with generated IDs. -
Keyboard Shortcuts
nizel-plugin-kbdrenders inline keyboard shortcuts as real<kbd>elements. -
Math
nizel-plugin-mathwraps inline$math$and display$$math for a host renderer such as KaTeX or MathJax. -
Media
nizel-plugin-mediaenhances standalone images by wrapping them in figures and adding native-friendly image attributes. -
Open Icon
nizel-plugin-open-iconrenders Open Icon SVGs from the installedopen-iconpackage. -
Print
nizel-plugin-printadds block directives for page breaks, print-only content, screen-only content, and page split control. -
Sanitize
nizel-plugin-sanitizeremoves risky HTML from rendered output. It is enabled by default innizel-kit. -
Table of Contents
nizel-plugin-tocrenders[[toc]]from document headings. -
Typography
nizel-plugin-typographyadds optional inline typography extensions: