{"id":15092934,"url":"https://github.com/denoland/deno-gfm","last_synced_at":"2025-05-16T12:03:32.647Z","repository":{"id":37704727,"uuid":"416080223","full_name":"denoland/deno-gfm","owner":"denoland","description":"Server-side GitHub Flavored Markdown rendering for Deno","archived":false,"fork":false,"pushed_at":"2024-10-24T16:33:55.000Z","size":406,"stargazers_count":223,"open_issues_count":22,"forks_count":36,"subscribers_count":15,"default_branch":"main","last_synced_at":"2024-10-29T17:19:05.065Z","etag":null,"topics":["deno","gfm","markdown"],"latest_commit_sha":null,"homepage":"https://jsr.io/@deno/gfm","language":"TypeScript","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/denoland.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2021-10-11T20:42:16.000Z","updated_at":"2024-10-25T02:31:17.000Z","dependencies_parsed_at":"2023-12-19T16:45:45.884Z","dependency_job_id":"c3050f7f-d816-4ea0-899d-52b5c2dfa4b7","html_url":"https://github.com/denoland/deno-gfm","commit_stats":{"total_commits":97,"total_committers":24,"mean_commits":4.041666666666667,"dds":0.6701030927835052,"last_synced_commit":"db24caff768795a0a717e7ba83e91d4de9946fee"},"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denoland%2Fdeno-gfm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denoland%2Fdeno-gfm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denoland%2Fdeno-gfm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/denoland%2Fdeno-gfm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/denoland","download_url":"https://codeload.github.com/denoland/deno-gfm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248545398,"owners_count":21122136,"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","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":["deno","gfm","markdown"],"created_at":"2024-09-25T11:01:54.994Z","updated_at":"2025-05-16T12:03:32.631Z","avatar_url":"https://github.com/denoland.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# deno-gfm\n\nServer-side GitHub Flavored Markdown rendering for Deno, including GitHub style\nCSS, syntax highlighting, and HTML sanitization.\n\n## Usage\n\nFirst install the package with the command:\n\n```sh\ndeno add jsr:@deno/gfm\n```\n\n```js\nimport { CSS, render } from \"@deno/gfm\";\n\nconst markdown = `\n# Hello, world!\n\n| Type | Value |\n| ---- | ----- |\n| x    | 42    |\n\n\\`\\`\\`js\nconsole.log(\"Hello, world!\");\n\\`\\`\\`\n`;\n\nconst body = render(markdown, {\n  baseUrl: \"https://example.com\",\n});\n\nconst html = `\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n    \u003cstyle\u003e\n      main {\n        max-width: 800px;\n        margin: 0 auto;\n      }\n      ${CSS}\n    \u003c/style\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cmain data-color-mode=\"light\" data-light-theme=\"light\" data-dark-theme=\"dark\" class=\"markdown-body\"\u003e\n      ${body}\n    \u003c/main\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n`;\n```\n\n### Styling\n\nThe GitHub CSS styles (https://primer.style) are used. There are two themes\navailable: light and dark.\n\nThere are three data attributes that can be used to control the theme:\n\n- `data-color-mode`: `light` or `dark` or `auto`.\n- `data-light-theme`: the name of the light theme (`light` or `dark`).\n- `data-dark-theme`: the name of the dark theme (`light` or `dark`).\n\nFor example, if you want to use the dark theme only, set the following:\n\n```html\n\u003cdiv data-color-mode=\"dark\" data-dark-theme=\"dark\" class=\"markdown-body\"\u003e\n  ... markdown body here ...\n\u003c/div\u003e\n```\n\nIf you want to use the light or dark theme depending on the user's browser\npreference, set the following:\n\n```html\n\u003cdiv\n  data-color-mode=\"auto\"\n  data-light-theme=\"light\"\n  data-dark-theme=\"dark\"\n  class=\"markdown-body\"\n\u003e\n  ... markdown body here ...\n\u003c/div\u003e\n```\n\nAlso see the example application in the `example/` directory.\n\n## Extensibility\n\nBy default syntax highlighting for JavaScript, Markdown, and HTML is included.\nYou can include more languages importing them:\n\n```js\nimport { CSS, render } from \"@deno/gfm\";\n\n// Add support for TypeScript, Bash, and Rust.\nimport \"npm:prismjs@1.29.0/components/prism-typescript.js\";\nimport \"npm:prismjs@1.29.0/components/prism-bash.js\";\nimport \"npm:prismjs@1.29.0/components/prism-rust.js\";\n```\n\nA full list of supported languages is available here:\nhttps://unpkg.com/browse/prismjs@1.29.0/components/\n\n## Inline rendering\n\nBy default, all rendering is in blocks. There are cases where one would like to\nrender some inline markdown, and this is achievable using the `inline` setting:\n\n```ts\nimport { render } from \"@deno/gfm\";\n\nconst markdown = \"My [Deno](https://deno.land) Blog\";\nconst header = render(markdown, { inline: true });\nconsole.log(header);\n```\n\n## Math rendering\n\nBy default math rendering is disabled. To enable it, you must include the\nadditional CSS and enable the `allowMath` setting:\n\n```ts\nimport { CSS, KATEX_CSS, render } from \"jsr:@deno/gfm\";\n\nconst markdown = `\nBlock math:\n\n$$ y = x^2 $$\n\nInline math: $y = x^2$\n`;\n\nconst body = render(markdown, {\n  allowMath: true,\n});\n\nconst html = `\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n    \u003cstyle\u003e\n      main {\n        max-width: 800px;\n        margin: 0 auto;\n      }\n      ${CSS}\n      ${KATEX_CSS}\n    \u003c/style\u003e\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cmain data-color-mode=\"light\" data-light-theme=\"light\" data-dark-theme=\"dark\" class=\"markdown-body\"\u003e\n      ${body}\n    \u003c/main\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n`;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenoland%2Fdeno-gfm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdenoland%2Fdeno-gfm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdenoland%2Fdeno-gfm/lists"}