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