{"id":19028665,"url":"https://github.com/x-govuk/govuk-markdown","last_synced_at":"2025-10-08T19:05:29.288Z","repository":{"id":37976109,"uuid":"466162355","full_name":"x-govuk/govuk-markdown","owner":"x-govuk","description":"Convert Markdown into GOV.UK Frontend-compliant HTML.","archived":false,"fork":false,"pushed_at":"2025-05-01T02:34:18.000Z","size":1064,"stargazers_count":7,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-09T07:27:11.113Z","etag":null,"topics":["design-system","govuk","markdown","marked"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/x-govuk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-04T14:52:27.000Z","updated_at":"2024-12-27T20:19:45.000Z","dependencies_parsed_at":"2023-12-15T21:54:38.414Z","dependency_job_id":"b4b854f0-2157-4ce4-99ec-9431d31e0bc4","html_url":"https://github.com/x-govuk/govuk-markdown","commit_stats":{"total_commits":40,"total_committers":4,"mean_commits":10.0,"dds":"0.17500000000000004","last_synced_commit":"cbf1f137efe9c0844d47753c55d48b2f6830a5ea"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/x-govuk/govuk-markdown","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-govuk%2Fgovuk-markdown","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-govuk%2Fgovuk-markdown/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-govuk%2Fgovuk-markdown/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-govuk%2Fgovuk-markdown/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/x-govuk","download_url":"https://codeload.github.com/x-govuk/govuk-markdown/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-govuk%2Fgovuk-markdown/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278722757,"owners_count":26034463,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["design-system","govuk","markdown","marked"],"created_at":"2024-11-08T21:11:59.982Z","updated_at":"2025-10-07T05:04:33.871Z","avatar_url":"https://github.com/x-govuk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GOV.UK Markdown · [![test](https://github.com/x-govuk/govuk-markdown/actions/workflows/test.yml/badge.svg)](https://github.com/x-govuk/govuk-markdown/actions/workflows/test.yml)\n\nConvert Markdown into [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend)-compliant HTML. It’s an extension to the [marked](https://marked.js.org) renderer and is inspired by its Ruby equivalent gem [`govuk_markdown`](https://github.com/DFE-Digital/govuk_markdown).\n\nDon’t confuse this package with [govspeak](https://github.com/alphagov/govspeak), which is a Markdown dialect specifically built for the GOV.UK publishing system.\n\n## Requirements\n\nNode.js v18 or later.\n\n## Installation\n\n`npm install govuk-markdown --save`\n\n## Usage\n\n```js\nconst { marked } = require('marked')\nconst govukMarkdown = require('govuk-markdown')\n\nmarked.use(govukMarkdown())\n```\n\nIf you are using [ES modules](https://nodejs.org/api/esm.html#introduction), import as follows:\n\n```js\nimport { marked } from 'marked'\nimport govukMarkdown from 'govuk-markdown'\n\nmarked.use(govukMarkdown())\n```\n\nWhen you call `marked`, the generated HTML will include the classes from GOV.UK Frontend. For example:\n\n```js\nmarked('[A link](/foo)')\n```\n\nWill output:\n\n```html\n\u003cp class=\"govuk-body\"\u003e\n  \u003ca class=\"govuk-link\" href=\"/foo\"\u003eA link\u003c/a\u003e\n\u003c/p\u003e\n```\n\n### Code highlighting\n\nBlock code is highlighted using [highlight.js](https://highlightjs.org). For example:\n\n````js\nmarked(\"```js\\nconsole.log('Hello, World!')\\n```\")\n````\n\nWill output:\n\n```html\n\u003cpre class=\"x-govuk-code x-govuk-code--block\" tabindex=\"0\"\u003e\n  \u003ccode class=\"x-govuk-code__language--js\"\u003e\n    \u003cspan class=\"x-govuk-code__variable\"\u003econsole\u003c/span\u003e.\u003cspan class=\"x-govuk-code__title\"\u003elog\u003c/span\u003e(\u003cspan class=\"x-govuk-code__string\"\u003e'Hello, World!'\u003c/span\u003e)\n  \u003c/code\u003e\n\u003c/pre\u003e\n```\n\n### Additional styles\n\nTo enable the styling for inline code, block code and checkboxes in task lists, add the following to your Sass file:\n\n```scss\n@import \"govuk-markdown/x-govuk/all\";\n```\n\n## Options\n\nIn addition to [marked’s options](https://marked.js.org/using_advanced#options), this extension accepts additional values:\n\n| Name                | Type     | Description                                                                  |\n| ------------------- | -------- | ---------------------------------------------------------------------------- |\n| `headingsStartWith` | `string` | Heading size to use for the top-level heading (`xl` or `l`). Default is `l`. |\n\nFor example:\n\n```js\nconst { marked } = require('marked')\nconst { govukMarkdown } = require('govuk-markdown')\n\nmarked.use(govukMarkdown({\n  headingsStartWith: 'xl'\n}))\n\nmarked('# Extra large heading')\n```\n\nWill output:\n\n```html\n\u003ch1 class=\"govuk-heading-xl\"\u003eExtra large heading\u003c/h1\u003e\n```\n\n## Testing\n\n`npm test`\n\n## Releasing a new version\n\n`npm run release`\n\nThis command will ask you what version you want to use. It will then publish a new version on NPM, create and push a new git tag and then generate release notes ready for posting on GitHub.\n\n\u003e [!NOTE]\n\u003e Releasing a new version requires permission to publish packages to the `@x-govuk` organisation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx-govuk%2Fgovuk-markdown","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fx-govuk%2Fgovuk-markdown","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx-govuk%2Fgovuk-markdown/lists"}