ts-markdown
Version:
An extensible TypeScript markdown generator that takes JSON and creates a markdown document.
27 lines (26 loc) • 841 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.italic = exports.italicRenderer = void 0;
const rendering_1 = require("../rendering");
/**
* The renderer for italic entries.
*
* @param entry The italic entry.
* @param options Document-level render options.
* @returns Italic markdown content.
*/
const italicRenderer = (entry, options) => {
if ('italic' in entry) {
let indicator = entry.indicator ?? options.italicIndicator ?? '*';
return `${indicator}${(0, rendering_1.getMarkdownString)(entry.italic, options)}${indicator}`;
}
throw new Error('Entry is not an italic entry. Unable to render.');
};
exports.italicRenderer = italicRenderer;
function italic(content, options) {
return {
italic: content,
...options,
};
}
exports.italic = italic;