Ferromark / Node.js
Configure Node.js Rendering
Pass an options object to a render function, or set it once when constructing a
Renderer. Use camelCase property names. Unknown keys throw a TypeError so
spelling mistakes cannot silently change your output.
Enable the features your content uses
import { type Options, toHtml } from "ferromark";
const options = {
insertions: true,
frontMatter: true,
headingIds: true,
footnotes: true,
tableColgroup: true,
tableColumnNames: true,
tableAttributes: true,
imageAttributes: true,
imageCaptions: true,
extendedAttributes: true,
bracketedSpans: true,
blockquoteAttributions: true,
autoAbbreviations: true,
abbreviations: { API: "Application Programming Interface", GraphQL: "", README: null },
} satisfies Options;
const html = toHtml("# Notes\n\nAn ++important++ detail.[^1]\n\n[^1]: More context.", options);
Omitted values use the package defaults. Set preset: "ffm" to start from
Ferromark Flavored Markdown instead: it enables the FFM syntax and
technical abbreviation markup, while individual options still override it and
the output policy stays unchanged. To add bare URL
and email detection to the default GFM extensions, set autolinkLiterals: true.
Typography is also explicit: set typography: { language: "en" } (or another
supported language) to run the built-in post-parse typography pass. It is off
when omitted and never detects or switches languages.
autoAbbreviations adds optional render-time <abbr> markup for technical
terms. Its exact override map can set titles, force a bare wrapper with an empty
string, or suppress a term with null; supplying the map alone does not enable
the feature. Empty override keys are ignored. See the
technical abbreviation guide.
Option reference
All properties are optional. Syntax examples and output semantics live in the FFM guide, with the CommonMark and GFM baseline in Markdown syntax.
Scroll sideways for more columns.
| Option | Default | Purpose |
|---|---|---|
renderPolicy | 'untrusted' | Escape raw HTML and check URL schemes; 'trusted' permits passthrough |
allowHtml | true | Permit raw HTML in trusted output; false escapes it |
allowLinkRefs | true | Resolve reference-style links |
tables | true | GFM pipe tables |
mergedTableCells | false | Horizontal cell spans; requires tables |
strikethrough | true | Double-tilde strikethrough |
insertions | false | Double-plus inserted text rendered as <ins> |
highlight | false | Highlight markup |
superscript | false | Superscript markup |
subscript | false | Subscript markup |
taskLists | true | Task-list checkboxes |
autolinkLiterals | false | Bare URL, www, and email links |
disallowedRawHtml | true | GFM tag filter in trusted mode |
footnotes | false | Reference footnotes |
inlineFootnotes | false | Inline footnotes |
frontMatter | false | Extract leading YAML/TOML-style front matter |
headingIds | true | Generate heading IDs |
headingOffset | 0 | Shift rendered heading levels; results clamp to h1–h6 |
headingIdPrefix | unset | Prefix heading IDs and permalink fragments; letters, digits, _, - |
math | false | Inline and display math markup |
callouts | true | GitHub-style note/warning callouts |
definitionLists | false | Terms and descriptions |
lineComments | false | Omit physical-line-start source comments |
linkBasePath | unset | Enable site routing for links, images, raw HTML URLs, and .md paths |
tableAttributes | false | Table IDs, CSS classes, and captions |
imageAttributes | false | Image IDs and CSS classes |
imageCaptions | false | Separate captions on standalone images |
blockquoteAttributions | false | Visible sources after block quotes |
extendedAttributes | false | Shared key/value suffixes on links, images, headings, tables, figures |
bracketedSpans | false | Native [text]{attributes} inline spans |
tableColgroup | false | CSS-addressable colgroup elements |
tableColumnNames | false | Header-derived column classes; requires tableColgroup |
headingAttributes | false | Explicit heading IDs and classes |
cjkEmphasis | false | CJK emphasis rules |
mdx | false | MDX syntax capture and static island output |
guillemetDigraphs | false | Preserve <<…>> for locale-aware typography |
typography | unset | Optional language-aware prose punctuation transform |
passes | unset | Ordered GitHub-reference, emoji-shortcode, and typography transforms |
autoAbbreviations | false | Wrap uppercase technical terms in <abbr> markup |
abbreviations | empty | Exact titles, bare-wrapper overrides, or null suppressions |
preset | unset | "ffm" starts from Ferromark Flavored Markdown; options still override |
Use passes when you need more than one transform or need to control their
order. Its entries use kind: "githubReferences" (with an explicit
repository), kind: "emojiShortcodes", or kind: "typography". Do not set
the separate typography option at the same time; put typography in passes
to make its position explicit.
typography requires a language from en, es, fr, pt, de, it,
nl, pl, ru, or uk. The dashes and ellipses switches can disable
those conversions independently. See the typography guide
for examples, locale rules, and protected syntax.
The published TypeScript declarations are the complete API contract and power editor autocomplete.
Preserve trusted HTML
import { toHtml } from "ferromark";
const html = toHtml('<span class="note">Internal note</span>', {
renderPolicy: "trusted",
});
Use this only for content you trust. It also permits arbitrary URL schemes.
The default disallowedRawHtml filter still removes GFM-disallowed tags; it is
not an HTML sanitizer. See rendering and trust.