{"id":20653474,"url":"https://github.com/t-ski/markdocs","last_synced_at":"2026-04-13T10:32:42.592Z","repository":{"id":46875465,"uuid":"509621197","full_name":"t-ski/markdocs","owner":"t-ski","description":"Simple Markdown to HTML translator supporting custom elements.","archived":false,"fork":false,"pushed_at":"2024-07-17T18:15:25.000Z","size":75,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T22:42:08.449Z","etag":null,"topics":["markdown","transpiler"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/t-ski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-07-02T00:32:39.000Z","updated_at":"2024-07-10T21:25:50.000Z","dependencies_parsed_at":"2024-03-10T20:21:06.732Z","dependency_job_id":"d4846961-ba47-4db3-8750-7b22ed207462","html_url":"https://github.com/t-ski/markdocs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/t-ski/markdocs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t-ski%2Fmarkdocs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t-ski%2Fmarkdocs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t-ski%2Fmarkdocs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t-ski%2Fmarkdocs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/t-ski","download_url":"https://codeload.github.com/t-ski/markdocs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/t-ski%2Fmarkdocs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31749119,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T09:16:15.125Z","status":"ssl_error","status_checked_at":"2026-04-13T09:16:05.023Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["markdown","transpiler"],"created_at":"2024-11-16T17:44:27.231Z","updated_at":"2026-04-13T10:32:42.561Z","avatar_url":"https://github.com/t-ski.png","language":"JavaScript","readme":"# markdocs\n\nSimple and fast Markdown to HTML translator supporting custom elements.\n\n## Installation\n\n``` bash\nnpm i t-ski/markdocs\n```\n\n``` js\nconst markdocs = require(\"markdocs\");\n```\n\n## Translation\n\n### From string\n\n``` js\nconst result = markdocs.translateStr(`\n    # Title\n\n    This is a **paragraph**.\n`);\n```\n\n↳\n\n``` html\n\u003ch1\u003eTitle\u003c/h1\u003e\n\u003cp\u003e\n    This is a \u003cb\u003eparagraph\u003c/b\u003e.\n\u003c/p\u003e\n```\n\n### From file\n\n``` js\nconst result = markdocs.translateFile(\"./docs/INTRO.md\");\n```\n\n#### Overloads\n\n• Invoke callback on translation result:\n\n``` js\nconst result = markdocs.translateFile(\"./docs/INTRO.md\", result =\u003e {\n    console.log(`Length of HTML representation: ${result.length}`);\n});\n```\n\n• Write translation result to file at given path:\n\n``` js\nconst result = markdocs.translateFile(\"./docs/INTRO.md\", \"./web/introduction.html\");\n```\n\n## Block Elements\n\nEach line in Markdown code represents a block element (a paragraph if not specific). A block element is indicated with a line prefix followed by a space character. The succeeding character sequence is considered its content.\n\n### Declaration syntax\n\n```\nnew markdocs.BlockElement(tokenName, tagNameOrWrapper, prefix, groupTagName, options)\n```\n\n| Parameter | Type | Purpose |\n| --------- | ---- | ------- |\n| `tokenName` | **String** | *Token name for internal organization* |\n| `tagNameOrWrapper` | **String, Function** | *Tag name (automatic) or function for (custom) wrapping* |\n| `prefix` | **String, RegExp** | *Prefix to associate with the element (RegExp escaped if given a string)* |\n| `groupTagName` | **String** | *Element compound group name to inject surrounding tag upon translation* |\n| `options` | **Object** | *Options object* |\n\n### Options\n\n| Property | Type | Purpose |\n| -------- | ---- | ------- |\n| `type` | **BlockElement.Type** | *Block element type* |\n| `inlineStyles` | **Boolean** | *Whether to parse inline elements and apply related styles to the element content* |\n\n### Block element types\n\n| Name | Description |\n| ---- | ----------- |\n| `FENCED` | *A block is opened until the next occurrence of the prefix (acting as a suffix). The lines in between are representing the respective block content.* |\n| `STANDALONE` | *A block does only consist of the prefix and does not allow for content. A standlone block is rendered as an empty tag.* |\n\n### Custom wrapper\n\nA custom wrapper function is getting passed either a content string or – iff associated with a fenced element – a content string array with the indicating line content (index 0), the spanned body contents (index 1, concatenated lines) and the closing line content (index 2). The returned value is used as the wrapped substitute for the raw parsing in the translation.\n\n### Example\n\n``` js\nnew markdocs.BlockElement(\"Custom Block Element\", \"q\", \"|\", \"div\");\n```\n\n``` js\nnew markdocs.BlockElement(\"Custom Fenced Block Element\", code =\u003e {\n    return `\u003cdiv class=\"custom-fenced\"\u003e\\n${code}\\n\u003c/div\u003e`;\n}, \"|\", null, {\n    inlineStyles: false,\n    type: markdocs.BlockElement.Type.FENCED\n});\n```\n\n## Inline Elements\n\nInline elements represent a certain (recurring) pattern occurrence in block contents. They are used for applying generic styles.\n\n### Declaration syntax\n\n```\nnew markdocs.InlineElement(tokenName, tagNameOrWrapper, pattern, options)\n```\n\n| Parameter | Type | Purpose |\n| --------- | ---- | ------- |\n| `tokenName` | **String** | *Token name for internal organization* |\n| `tagNameOrWrapper` | **String, Function** | *Tag name (automatic) or function for (custom) wrapping* |\n| `pattern` | **RegExp** | *Occurrence pattern* |\n| `options` | **Object** | *Options object* |\n\n### Options\n\n| Property | Type | Purpose |\n| -------- | ---- | ------- |\n| `priority` | **Number** | *Numeric (increasing) value to manipulate the parsing order (useful for ambiguous contexts)* |\n\n### Example\n\n``` js\nnew markdocs.InlineElement(\"Custom Inline Element\", \"span\" , \"::\");\n```\n  \n---\n\n## Default Elements (supported MD)\n\n### Block elements\n\n- [x] Headings {1, ... , 6}\n```\n# Heading {#optional-id}\n```\n\n- [x] Blockquote  \n```\n\u003e Blockquote...\n```\n\n- [x] Ordered List  \n```\n1. List item\n2. List item\n```\n\n- [x] Unordered List  \n```\n- List item\n- List item\n```\n\n- [x] Horizontal Rule  \n```\n---\n```\n\n- [x] Table  \n```\n| Table head 1    | Table head 2    |\n| --------------- | --------------: |\n| Table entry 1.1 | Table entry 2.1 |\n| Table entry 1.2 | Table entry 2.2 |\n```\n\n- [x] Fenced Code  \n\u003cpre\u003e\n``` js\nalert(\"Hello world!\");\n```\n\u003c/pre\u003e\n\n### Inline elements\n\n- [x] Link  \n```\n[Click here](./link.html)\n```\n\n- [x] Image  \n```\n![Logo](./img/logo.svg)\n```\n\n- [x] Bold  \n```\n**Bold text**\n```\n\n- [x] Italic  \n```\n*Italic text*\n```\n\n- [x] Strikethrough  \n```\n~Strikethrough text~\n```\n\n- [x] Highlight  \n```\n==Highlighted text==\n```\n\n- [x] Subscript  \n```\nA~sub~\n```\n\n- [x] Superscript  \n```\nB^sup^\n```\n\n- [x] Inline code  \n\u003cpre\u003e\n`INLINE CODE`\n\u003c/pre\u003e\n\n## \n\n\u003csub\u003e© Thassilo Martin Schiepanski\u003c/sub\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft-ski%2Fmarkdocs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ft-ski%2Fmarkdocs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft-ski%2Fmarkdocs/lists"}