Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/comrak/mod.ts>ComrakExtensionOptions

WASM bindings for the comrak markdown renderer
Latest
interface ComrakExtensionOptions
import { type ComrakExtensionOptions } from "https://deno.land/x/comrak@0.1.1/mod.ts";

Options to select extensions.

Properties

optional
descriptionLists: boolean

Enables the description lists extension.

Each term must be defined in one paragraph, followed by a blank line, and then by the details. Details begins with a colon.

markdownToHTML("Term\n\n: Definition", { extension: { descriptionLists: true } });
"<dl><dt>Term</dt>\n<dd>\n<p>Definition</p>\n</dd>\n</dl>\n"

Defaults to false.

optional
footnotes: boolean

Enables the footnotes extension per cmark-gfm.

The extension is modelled after Kramdown.

markdownToHTML("Hi[^x].\n\n[^x]: A greeting.\n", { extension: { footnotes: true } });
"<p>Hi<sup class=\"footnote-ref\"><a href=\"#fn1\" id=\"fnref1\">1</a></sup>.</p>\n<section class=\"footnotes\">\n<ol>\n<li id=\"fn1\">\n<p>A greeting. <a href=\"#fnref1\" class=\"footnote-backref\">↩</a></p>\n</li>\n</ol>\n</section>\n"

Defaults to false.

optional
frontMatterDelimiter: string | null

Enables the front matter extension.

Front matter, which begins with the delimiter string at the beginning of the file and ends at the end of the next line that contains only the delimiter, is passed through unchanged in markdown output and omitted from HTML output.

markdownToHTML("---\nlayout: post\n---\nText\n", { extension: { frontMatterDelimiter: "---" } });
"<p>Text</p>\n"

Defaults to null.

optional
headerIDs: string | null

Enables the header IDs Comrak extension.

markdownToHTML("# README\n", { extension: { headerIDs: "user-content-" } });
"<h1><a href=\"#readme\" aria-hidden=\"true\" class=\"anchor\" id=\"user-content-readme\"></a>README</h1>\n"

Defaults to null.

optional
strikethrough: boolean

Enables the strikethrough extension from the GFM spec.

markdownToHTML("Hello ~world~ there.\n", { extension: { strikethrough: true } });
"<p>Hello <del>world</del> there.</p>\n"

Defaults to false.

optional
superscript: boolean

Enables the superscript Comrak extension.

markdownToHTML("e = mc^2^.\n", { extension: { superscript: true } });
"<p>e = mc<sup>2</sup>.</p>\n"

Defaults to false.

optional
table: boolean

Enables the table extension from the GFM spec.

markdownToHTML("| a | b |\n|---|---|\n| c | d |\n", { extension: { table: true } });
"<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n</tr>\n</thead>\n\
 <tbody>\n<tr>\n<td>c</td>\n<td>d</td>\n</tr>\n</tbody>\n</table>\n"

Defaults to false.

optional
tagfilter: boolean

Enables the tagfilter extension from the GFM spec.

markdownToHTML("Hello <xmp>.\n\n<xmp>", { extension: { tagfilter: true } });
"<p>Hello &lt;xmp>.</p>\n&lt;xmp>\n"

Defaults to false.

optional
tasklist: boolean

Enables the task list items extension from the GFM spec.

Note that the spec does not define the precise output, so only the bare essentials are rendered.

markdownToHTML("* [x] Done\n* [ ] Not done\n", { extension: { tasklist: true } });
"<ul>\n<li><input type=\"checkbox\" disabled=\"\" checked=\"\" /> Done</li>\n\
 <li><input type=\"checkbox\" disabled=\"\" /> Not done</li>\n</ul>\n"

Defaults to false.