UNPKG

ts-markdown

Version:

An extensible TypeScript markdown generator that takes JSON and creates a markdown document.

33 lines (32 loc) 991 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.bold = exports.boldRenderer = void 0; const rendering_1 = require("../rendering"); /** * The renderer for bold entries. * * @param entry The renderer for bolded entries. * @param options Document-level render options. * @returns Bolded markdown content. */ const boldRenderer = (entry, options) => { if ('bold' in entry) { let indicator = entry.indicator ?? options.boldIndicator ?? '*'; return `${indicator}${indicator}${(0, rendering_1.getMarkdownString)(entry.bold, options)}${indicator}${indicator}`; } throw new Error('Entry is not a bold entry. Unable to render.'); }; exports.boldRenderer = boldRenderer; /** * Helper which creates a bold text entry. * * @param options Entry-level options for this element. * @returns a bold text entry */ function bold(content, options) { return { bold: content, ...options, }; } exports.bold = bold;