ts-markdown
Version:
An extensible TypeScript markdown generator that takes JSON and creates a markdown document.
32 lines (31 loc) • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.strikethrough = exports.strikethroughRenderer = void 0;
const rendering_1 = require("../rendering");
/**
* The renderer for strickethrough text entries.
*
* @param entry The strikethrough entry.
* @param options Document-level render options.
* @returns Strikethrough markdown content.
*/
const strikethroughRenderer = (entry, options) => {
if ('strikethrough' in entry) {
return `~~${(0, rendering_1.getMarkdownString)(entry.strikethrough, options)}~~`;
}
throw new Error('Entry is not a strikethrough entry. Unable to render.');
};
exports.strikethroughRenderer = strikethroughRenderer;
/**
* Helper which creates a strikethrough text entry.
*
* @param options Entry-level options for this element.
* @returns a strikethrough text entry
*/
function strikethrough(content, options) {
return {
strikethrough: content,
...options,
};
}
exports.strikethrough = strikethrough;