UNPKG

ts-markdown

Version:

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

35 lines (34 loc) 882 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.hr = exports.hrRenderer = void 0; /** * The renderer for hr entries. * * @param entry The hr entry. * @param options Document-level render options. * @returns Block-level hr markdown content. */ const hrRenderer = (entry, options) => { if ('hr' in entry) { let indicator = entry.indicator ?? '-'; return { markdown: `${indicator}${indicator}${indicator}`, blockLevel: true, }; } throw new Error('Entry is not an hr entry. Unable to render.'); }; exports.hrRenderer = hrRenderer; /** * Helper which creates a horizontal rule entry. * * @param options Entry-level options for this element. * @returns a horizontal rule entry */ function hr(options) { return { hr: true, ...options, }; } exports.hr = hr;