UNPKG

@x-govuk/govuk-eleventy-plugin

Version:

Write documentation using Markdown and publish it using GOV.UK styles

20 lines (16 loc) 470 B
import { md } from '../markdown-it.js' import { normalise } from '../utils.js' /** * Convert Markdown into GOV.UK Frontend-compliant HTML * * @param {string} string - Markdown string * @param {string} value - If `inline`, renders HTML without paragraph tags * @returns {string} HTML */ export function markdown(string, value) { string = normalise(string, '') if (value === 'inline') { return md().renderInline(string) } return md().render(string) }