{"id":20457286,"url":"https://github.com/obedm503/showdown-katex","last_synced_at":"2025-06-14T02:04:48.650Z","repository":{"id":11738457,"uuid":"70408195","full_name":"obedm503/showdown-katex","owner":"obedm503","description":"Math typesetting for showdown","archived":false,"fork":false,"pushed_at":"2022-10-19T19:25:22.000Z","size":2295,"stargazers_count":38,"open_issues_count":7,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-12T07:43:25.326Z","etag":null,"topics":["asciimath","katex","latex","markdown","math","showdown"],"latest_commit_sha":null,"homepage":"https://obedm503.github.io/showdown-katex/","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/obedm503.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-09T14:24:42.000Z","updated_at":"2025-04-09T08:32:53.000Z","dependencies_parsed_at":"2023-01-14T07:45:26.043Z","dependency_job_id":null,"html_url":"https://github.com/obedm503/showdown-katex","commit_stats":null,"previous_names":["obedm503/katex-latex"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/obedm503/showdown-katex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obedm503%2Fshowdown-katex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obedm503%2Fshowdown-katex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obedm503%2Fshowdown-katex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obedm503%2Fshowdown-katex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/obedm503","download_url":"https://codeload.github.com/obedm503/showdown-katex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/obedm503%2Fshowdown-katex/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259747196,"owners_count":22905308,"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":["asciimath","katex","latex","markdown","math","showdown"],"created_at":"2024-11-15T12:06:25.816Z","updated_at":"2025-06-14T02:04:48.628Z","avatar_url":"https://github.com/obedm503.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# showdown-katex\n\n\u003e `npm install showdown-katex`\n\n[Showdown](https://github.com/showdownjs/showdown) extension to render [LaTeX](https://www.latex-project.org/) math and [AsciiMath](http://asciimath.org/) using [KaTeX](https://khan.github.io/KaTeX/);\n\nSpecial characters do not need escaping\n\n\u003e Works well alongside [bootmark](https://obedm503.github.io/bootmark/)\n\n## Config\n\nYou can customize what gets passed to the katex renderer by passing a config object.\n\nThese are the defaults:\n\n```js\n{\n  displayMode: true,\n  throwOnError: false, // allows katex to fail silently\n  errorColor: '#ff0000',\n  delimiters: [\n    { left: \"$$\", right: \"$$\", display: false },\n    { left: '~', right: '~', display: false, asciimath: true },\n  ],\n}\n```\n\nExamples:\n\n```html\n\u003cscript\u003e\n  const converter = new showdown.Converter({\n    extensions: [\n      showdownKatex({\n        // maybe you want katex to throwOnError\n        throwOnError: true,\n        // disable displayMode\n        displayMode: false,\n        // change errorColor to blue\n        errorColor: '#1500ff',\n      }),\n    ],\n  });\n  converter.makeHtml('~x=2~');\n\u003c/script\u003e\n```\nCheck [katex for more details](https://github.com/Khan/KaTeX#user-content-rendering-options).\n\n### Default Delimiters\n\n| Format    | Left | Right | Display mode |\n| --------- | ---- | ----- | ------------ |\n| Latex     | `$$` | `$$`  | `false`      |\n| Asciimath | `~`  | `~`   | `false`      |\n\nTo define custom delimiters simply define a `delimiters` property in the config as an array of objects. Each object MUST have a `left` (`string`) property with the left delimiter, and a `right` (`string`) property with the right delimiter. The oject may also have a `display` (`boolean`) property if the delimiter should use display mode instead of inline mode, and an `asciimath` (`boolean`) id the delimiter is Asciimath instead of Latex.\n\nCustom delimiters won't disable the defaults, so you can use both custom and default delimiters.\n\n```js\nconst converter = new showdown.Converter({\n  extensions: [\n    showdownKatex({\n      delimiters: [{ left: '( ͡° ͜ʖ ͡°)', right: '( ͡° ͜ʖ ͡°)', asciimath: true }],\n    }),\n  ],\n});\nconverter.makeHtml(\n  'some text here, ( ͡° ͜ʖ ͡°) E=mc^2 ( ͡° ͜ʖ ͡°), you can still use ~ E=Mc^2 ~',\n);\n```\n\n\n## FOUC\n\nIf your page suffers from a \"Flash Of Unstyled Content,\"  add this to your `\u003cbody\u003e` tag:\n\n```html\n\u003cbody style=\"display:none;\" onload=\"document.body.style.display='block'\"\u003e\n```\nThis hides the body and shows it only when the JavaScript has loaded.\n\n## Math Example\n\n    ```asciimath\n    x = (-b +- sqrt(b^2-4ac)) / (2a)\n    ```\n\n```asciimath\nx = (-b +- sqrt(b^2-4ac)) / (2a)\n```\n\n    ```latex\n    x=\\frac{ -b\\pm\\sqrt{ b^2-4ac } } {2a}\n    ```\n\n```latex\nx=\\frac{ -b\\pm\\sqrt{ b^2-4ac } } {2a}\n```\n\nThey will both render the exact same thing. If the examples don't render correctly click [here](https://obedm503.github.io/showdown-katex/).\n\n----\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobedm503%2Fshowdown-katex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobedm503%2Fshowdown-katex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobedm503%2Fshowdown-katex/lists"}