Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use recommended extension export #91

Merged
merged 1 commit into from
Dec 10, 2023
Merged

Use recommended extension export #91

merged 1 commit into from
Dec 10, 2023

Conversation

paulrobertlloyd
Copy link
Contributor

@paulrobertlloyd paulrobertlloyd commented Dec 10, 2023

Use the export format recommended by marked, which provides an extensions options value.

This means that:

const GovukHTMLRenderer = require('govuk-markdown')

marked.setOptions({
  renderer: new GovukHTMLRenderer()
})

becomes…

const govukMarkdown = require('govuk-markdown')

marked.use(govukMarkdown())

It also means options are provided to the extension itself, rather than polluting marked’s own options object, i.e.:

marked.use(govukMarkdown({
  headingsStartWith: 'xl'
}))

@paulrobertlloyd paulrobertlloyd marked this pull request as ready for review December 10, 2023 22:16
@paulrobertlloyd paulrobertlloyd merged commit 3d5ecb5 into main Dec 10, 2023
1 check passed
@paulrobertlloyd paulrobertlloyd deleted the marked-extension branch December 10, 2023 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant