{"id":19028662,"url":"https://github.com/x-govuk/marked-govspeak","last_synced_at":"2025-10-08T19:05:39.954Z","repository":{"id":36982975,"uuid":"467325929","full_name":"x-govuk/marked-govspeak","owner":"x-govuk","description":"Govspeak Markdown extensions for Marked.","archived":false,"fork":false,"pushed_at":"2025-02-01T02:27:44.000Z","size":645,"stargazers_count":3,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-16T20:57:33.645Z","etag":null,"topics":["govspeak","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-08T01:54:53.000Z","updated_at":"2024-12-27T20:43:24.000Z","dependencies_parsed_at":"2024-05-01T03:29:43.669Z","dependency_job_id":"42a4dabf-6565-4e50-9237-c349d06b4c5d","html_url":"https://github.com/x-govuk/marked-govspeak","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/x-govuk/marked-govspeak","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-govuk%2Fmarked-govspeak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-govuk%2Fmarked-govspeak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-govuk%2Fmarked-govspeak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-govuk%2Fmarked-govspeak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/x-govuk","download_url":"https://codeload.github.com/x-govuk/marked-govspeak/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/x-govuk%2Fmarked-govspeak/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271406123,"owners_count":24753918,"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-08-20T02:00:09.606Z","response_time":69,"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":["govspeak","govuk","markdown","marked"],"created_at":"2024-11-08T21:11:59.736Z","updated_at":"2025-10-08T19:05:34.926Z","avatar_url":"https://github.com/x-govuk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Govspeak Markdown · [![test](https://github.com/x-govuk/marked-govspeak/actions/workflows/test.yml/badge.svg)](https://github.com/x-govuk/marked-govspeak/actions/workflows/test.yml)\n\n[Govspeak](https://github.com/alphagov/govspeak) Markdown extensions for [Marked](https://github.com/markedjs/marked).\n\n## Requirements\n\nNode.js v18 or later.\n\n## Installation\n\n```shell\nnpm install @x-govuk/marked-govspeak\n```\n\n## Usage\n\n```js\nimport { marked } from 'marked'\nimport govspeak from '@x-govuk/marked-govspeak'\n\nmarked.use(govspeak())\n```\n\nWhen you call `marked`, the generated HTML will include the classes to style the Govspeak Markdown extensions. For example:\n\n```js\nmarked('%This is a warning callout%')\n```\n\nwill output:\n\n```html\n\u003cdiv class=\"govspeak-warning-callout\" role=\"note\" aria-label=\"Warning\"\u003e\n  \u003cp\u003eThis is a warning callout\u003c/p\u003e\n\u003c/div\u003e\n```\n\nTo enable the styling you will need to add the following to your Sass file:\n\n```scss\n@import \"node_modules/@x-govuk/marked-govspeak/govspeak/all\";\n```\n\n## Differences from the Govspeak Ruby gem\n\nUnlike [the Govspeak gem](https://github.com/alphagov/govspeak), this package is not used to publish any part of GOV.UK. For that reason, it doesn’t support the following extensions:\n\n- bar charts\n- cross domain tracking on buttons\n- embedded content and attachment links\n- tables that use Kramdown syntax\n\nThis package also provides its own set of CSS styles, based on [those used by GOV.UK Publishing Components](https://github.com/alphagov/govuk_publishing_components/tree/main/app/assets/stylesheets/govuk_publishing_components/components/govspeak).\n\nThe class names used also differ, each prefixed with `govspeak-`. Therefore a `govspeak` or `gem-c-govspeak` class is not needed on any parent container.\n\n### Using original Govspeak gem classes\n\nIf you wish to generate class names that match those from the Govspeak Ruby gem, you can pass the `govspeakGemCompatibility` option to marked. For example:\n\n```js\nimport { marked } from 'marked'\nimport govspeak from '@x-govuk/marked-govspeak'\n\nmarked.use(govspeak({\n  govspeakGemCompatibility: true\n}))\n\nmarked('%This is a warning callout%')\n```\n\nwill output:\n\n```html\n\u003cdiv class=\"application-notice help-notice\" role=\"note\" aria-label=\"Warning\"\u003e\n  \u003cp\u003eThis is a warning callout\u003c/p\u003e\n\u003c/div\u003e\n```\n\n\u003e [!NOTE]\\\n\u003e You will need to provide your own styles if you use this option.\n\n## Supported extensions\n\n### Address\n\n```md\n$A\nHM Revenue and Customs\nBradford\nBD98 1YY\n$A\n```\n\n```html\n\u003cdiv class=\"govspeak-address\"\u003e\n  \u003cdiv class=\"adr org fn\"\u003e\n    \u003cp\u003e\n      HM Revenue and Customs\u003cbr /\u003e\n      Bradford\u003cbr /\u003e\n      BD98 1YY\n    \u003c/p\u003e\n  \u003c/div\u003e\n\u003c/div\u003e\n```\n\n### Buttons\n\nAn accessible way to add button links into content.\n\n#### Default button\n\n```md\n{button}[Continue](https://gov.uk/random){/button}\n```\n\n```html\n\u003ca class=\"govuk-button\" href=\"https://gov.uk/random\" role=\"button\"\u003e\n  Continue\n\u003c/a\u003e\n```\n\n#### Start button\n\nTo turn a button into a [‘Start now’ button](https://design-system.service.gov.uk/components/button/#start-buttons), you can pass `start` to the button tag:\n\n```md\n{button start}[Start Now](https://gov.uk/random){/button}\n```\n\n```html\n\u003ca\n  class=\"govuk-button govuk-button--start\"\n  href=\"https://gov.uk/random\"\n  role=\"button\"\n\u003e\n  Start Now\n  \u003csvg\n    class=\"govuk-button__start-icon\"\n    xmlns=\"http://www.w3.org/2000/svg\"\n    width=\"17.5\"\n    height=\"19\"\n    viewBox=\"0 0 33 40\"\n    role=\"presentation\"\n    focusable=\"false\"\n  \u003e\n    \u003cpath fill=\"currentColor\" d=\"M0 0h13l20 20-20 20H0l20-20z\"\u003e\u003c/path\u003e\n  \u003c/svg\u003e\n\u003c/a\u003e\n```\n\n### Callouts\n\n#### Information callout\n\n```md\n^This is useful information that’s worth knowing.^\n```\n\n```html\n\u003cdiv class=\"govspeak-information-callout\" role=\"note\" aria-label=\"Information\"\u003e\n  \u003cp\u003eThis is useful information that’s worth knowing.\u003c/p\u003e\n\u003c/div\u003e\n```\n\n#### Warning callout\n\n```md\n%You will be fined or put in prison if you don’t do this thing.%\n```\n\n```html\n\u003cdiv class=\"govspeak-warning-callout\" role=\"note\" aria-label=\"Warning\"\u003e\n  \u003cp\u003eYou will be fined or put in prison if you don’t do this thing.\u003c/p\u003e\n\u003c/div\u003e\n```\n\n#### Example callout\n\n```md\n$E\nOpen the pod bay doors.\n$E\n```\n\n```html\n\u003cdiv class=\"govspeak-example\"\u003e\n  \u003cp\u003eOpen the pod bay doors.\u003c/p\u003e\n\u003c/div\u003e\n```\n\n### Call to action\n\n```md\n$CTA\nThis is a call to action\n$CTA\n```\n\n```html\n\u003cdiv class=\"govspeak-call-to-action\"\u003e\n  \u003cp\u003eThis is a call to action\u003c/p\u003e\n\u003c/div\u003e\n```\n\n### Contact\n\n```md\n$C\nFinancial Conduct Authority\n\u003cconsumer.queries@fca.org.uk\u003e\nTelephone: 0800 111 6768\nMonday to Friday, 8am to 6pm\nSaturday, 9am to 1pm\n[Find out about call charges](/call-charges)\n$C\n```\n\n```html\n\u003cdiv class=\"govspeak-contact\"\u003e\n  \u003cp\u003e\n    Financial Conduct Authority\u003cbr /\u003e\n    \u003ca href=\"mailto:consumer.queries@fca.org.uk\"\u003econsumer.queries@fca.org.uk\u003c/a\n    \u003e\u003cbr /\u003e\n    Telephone: 0800 111 6768\u003cbr /\u003e\n    Monday to Friday, 8am to 6pm\u003cbr /\u003e\n    Saturday, 9am to 1pm\u003cbr /\u003e\n    \u003ca href=\"/call-charges\"\u003eFind out about call charges\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n```\n\n### Download link\n\n```md\n$D\n[Download ‘Jobcentre Plus form for employment’ (PDF, 43KB)](/example.pdf)\n$D\n```\n\n```html\n\u003cdiv class=\"govspeak-form-download\"\u003e\n  \u003cp\u003e\n    \u003ca href=\"/example.pdf\"\n      \u003eDownload ‘Jobcentre Plus form for employment’ (PDF, 43KB)\u003c/a\n    \u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n```\n\n### Place\n\n```md\n$P\nThis is a place.\n$P\n```\n\n```html\n\u003cdiv class=\"govspeak-place\"\u003e\n  \u003cp\u003eThis is a place.\u003c/p\u003e\n\u003c/div\u003e\n```\n\n### Information\n\n```md\n$I\nThis is information.\n$I\n```\n\n```html\n\u003cdiv class=\"govspeak-information\"\u003e\n  \u003cp\u003eThis is information.\u003c/p\u003e\n\u003c/div\u003e\n```\n\n### Statistic headline\n\n```md\n{stat-headline}\n_13.8bn_ years since the big bang\n{/stat-headline}\n```\n\n```html\n\u003cdiv class=\"govspeak-stat-headline\"\u003e\n  \u003cp\u003e\u003cem\u003e13.8bn\u003c/em\u003e years since the big bang\u003c/p\u003e\n\u003c/div\u003e\n```\n\n### Steps\n\n```md\ns1. Add numbers.\ns2. Check numbers.\ns3. Love numbers.\n```\n\n```html\n\u003col class=\"govuk-steps\"\u003e\n  \u003cli\u003eAdd numbers.\u003c/li\u003e\n  \u003cli\u003eCheck numbers.\u003c/li\u003e\n  \u003cli\u003eLove numbers.\u003c/li\u003e\n\u003c/ol\u003e\n```\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%2Fmarked-govspeak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fx-govuk%2Fmarked-govspeak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fx-govuk%2Fmarked-govspeak/lists"}