comrak
Version:
Comrak is an efficient, extensible, and highly configurable Markdown parser and renderer, written in Rust and compiled to WebAssembly. Portable and agnostic, it works seamlessly in any WebAssembly-friendly JS runtime.
92 lines (91 loc) • 2.64 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Options = exports.defaultOptions = void 0;
const _internal_js_1 = require("./_internal.js");
/**
* Default options for the various parsing, rendering, and conversion functions
* in the Comrak library.
*
* @category Options
*/
exports.defaultOptions = {
extension: {
autolink: false,
descriptionLists: false,
footnotes: false,
inlineFootnotes: false,
frontMatterDelimiter: null,
headerIDs: null,
strikethrough: false,
superscript: false,
table: false,
tagfilter: false,
tasklist: false,
multilineBlockQuotes: false,
alerts: false,
mathDollars: false,
mathCode: false,
wikilinksTitleBeforePipe: false,
wikilinksTitleAfterPipe: false,
underline: false,
subscript: false,
spoiler: false,
shortcodes: false,
greentext: false,
linkURLRewriter: null,
imageURLRewriter: null,
cjkFriendlyEmphasis: false,
subtext: false,
highlight: false,
},
parse: {
defaultInfoString: null,
smart: false,
relaxedTasklistMatching: false,
tasklistInTable: false,
relaxedAutolinks: false,
ignoreSetext: false,
brokenLinkCallback: null,
leaveFootnoteDefinitions: false,
escapedCharSpans: false,
},
render: {
escape: false,
githubPreLang: false,
hardbreaks: false,
unsafe: false,
width: 0,
fullInfoString: false,
listStyle: "dash",
sourcepos: false,
escapedCharSpans: false,
ignoreEmptyLinks: false,
gfmQuirks: false,
preferFenced: false,
figureWithCaption: false,
tasklistClasses: false,
olWidth: 0,
experimentalMinimizeCommonmark: false,
},
plugins: {
render: {
codefenceSyntaxHighlighter: null,
headingAdapter: null,
},
},
};
/**
* The `Options` object contains the default options for Comrak, as well as a
* `default` helper method to obtain a fresh copy of those defaults.
*
* This is useful when constructing new options objects to pass to Comrak's
* parsing, rendering, and conversion functions, as it ensures that all fields
* are set and avoids any issues with mutation-related side-effects.
*
* @category Options
* @tags defaults
*/
exports.Options = {
__proto__: exports.defaultOptions,
default: () => (0, _internal_js_1.cloneDeep)(exports.defaultOptions),
};