import { type ComrakExtensionOptions } from "https://deno.land/x/comrak@0.1.1/mod.ts";
Options to select extensions.
Properties
Enables the autolink extension from the GFM spec.
markdownToHTML("Hello www.github.com.\n", { extension: { autolink: true } });
"<p>Hello <a href=\"http://www.github.com\">www.github.com</a>.</p>\n"
Defaults to false
.
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
.
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
.
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
.
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
.
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
.
Enables the superscript Comrak extension.
markdownToHTML("e = mc^2^.\n", { extension: { superscript: true } });
"<p>e = mc<sup>2</sup>.</p>\n"
Defaults to false
.
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
.
Enables the tagfilter extension from the GFM spec.
markdownToHTML("Hello <xmp>.\n\n<xmp>", { extension: { tagfilter: true } });
"<p>Hello <xmp>.</p>\n<xmp>\n"
Defaults to false
.
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
.