diff --git a/index.js b/index.js index 9f1fa6f..fdf0050 100644 --- a/index.js +++ b/index.js @@ -2,8 +2,9 @@ const highlightJs = require('highlight.js') /** * Add GOV.UK typography classes to blockquotes, headings, paragraphs, links, - * lists, section breaks and tables. - * @param {object} [options] Options for the extension + * lists, section breaks and tables + * + * @param {object} [options] - Options for the extension * @returns {object} A MarkedExtension to be passed to `marked.use()` */ module.exports = function (options = {}) { @@ -45,9 +46,9 @@ module.exports = function (options = {}) { const FIGURE_RE = /(]+)>)?
\n` } + + return `${text}
\n` }, // Links @@ -56,9 +57,9 @@ module.exports = function (options = {}) { if (title) { return `${text}` - } else { - return `${text}` } + + return `${text}` }, // Lists @@ -142,10 +143,10 @@ module.exports = function (options = {}) { code = highlightJs.highlightAuto(text).value } return `${code}
\n`
- } else {
- // No language found, so render as plain text
- return `${text}\n` } + + // No language found, so render as plain text + return `
${text}\n` }, // Inline code diff --git a/test/index.js b/test/index.js index e85accb..8a11a27 100644 --- a/test/index.js +++ b/test/index.js @@ -1,6 +1,8 @@ const assert = require('node:assert/strict') const test = require('node:test') + const { marked } = require('marked') + const govukMarkdown = require('../index.js') marked.use(govukMarkdown())