{"id":23143418,"url":"https://github.com/xieyuheng/postmark","last_synced_at":"2025-10-30T14:48:27.510Z","repository":{"id":45200995,"uuid":"425482750","full_name":"xieyuheng/postmark","owner":"xieyuheng","description":"A framework for building markdown extensions.","archived":false,"fork":false,"pushed_at":"2023-03-18T17:30:16.000Z","size":2034,"stargazers_count":30,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-05T08:41:21.252Z","etag":null,"topics":["content-managment","markdown","markdown-extension","parser"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xieyuheng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE-OF-CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-07T11:18:50.000Z","updated_at":"2023-10-04T08:10:09.000Z","dependencies_parsed_at":"2022-09-04T05:11:08.423Z","dependency_job_id":null,"html_url":"https://github.com/xieyuheng/postmark","commit_stats":null,"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"purl":"pkg:github/xieyuheng/postmark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xieyuheng%2Fpostmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xieyuheng%2Fpostmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xieyuheng%2Fpostmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xieyuheng%2Fpostmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xieyuheng","download_url":"https://codeload.github.com/xieyuheng/postmark/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xieyuheng%2Fpostmark/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270859419,"owners_count":24658205,"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-17T02:00:09.016Z","response_time":129,"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":["content-managment","markdown","markdown-extension","parser"],"created_at":"2024-12-17T15:13:25.483Z","updated_at":"2025-10-15T04:32:45.824Z","avatar_url":"https://github.com/xieyuheng.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Postmark\n\nA framework for building markdown extensions.\n\n## Install\n\n```bash\nnpm i @xieyuheng/postmark\n```\n\n## Used By\n\n- [Sisuo App](https://sisuo.app)\n- [Readonly.Link](https://readonly.link)\n- [Xie Yuheng Website](https://xieyuheng.com)\n\n## Usage\n\n### Command Line Interface\n\nAfter installed the `@xieyuheng/postmark` package, you can run `postmark help` to see help messages.\n\n## API Docs\n\n### `Postmark.createParser(opts: ParserOptions)`\n\n```typescript\nimport Postmark from \"@xieyuheng/postmark\"\n\nconst parser = Postmark.createParser({\n  enableTable: true, // default\n})\n```\n\n### `parser.parseDocument(text: string)`\n\n```typescript\nconst text = `\\\n---\ntitle: The principle of type theory\ndate: 2021-08-27\nauthor: Xie Yuheng\n---\n\n# The principle\n\nThe principle of type theory is:\n\n\u003e We should study **terms** and **types** together.\n`\n\nconst document = parser.parseDocument(text)\n\nconsole.log(document)\n```\n\nOutput:\n\n``` javascript output\nDocument {\n  kind: 'Document',\n  attributes: {\n    title: 'The principle of type theory',\n    date: 2021-08-27T00:00:00.000Z,\n    author: 'Xie Yuheng'\n  },\n  span: Span {\n    start: Position { line: 1, column: 1 },\n    end: Position { line: 5, column: 51 }\n  },\n  children: [\n    Headline { ... },\n    Paragraph { ... },\n    BlockQuote { ... }\n  ]\n}\n```\n\n### `parser.use\u003cT\u003e(plugin: Plugin\u003cT\u003e)`\n\n```typescript\nconst parser = Postmark.createParser()\n  .use\u003cnull\u003e({\n    kind: \"CustomBlock\",\n    customKind: \"Katex\",\n    recognize: ({ name }) =\u003e name.toLowerCase() === \"katex\",\n  })\n  .use\u003cDialog\u003e({\n    kind: \"CustomItem\",\n    customKind: \"Dialog\",\n    recognize: (item) =\u003e\n      item.start.some((tag) =\u003e tag.name.toLowerCase() === \"dialog\"),\n    build: (item, { previousCustomItems }) =\u003e\n      Dialog.build(item, { previousCustomItems }),\n  })\n```\n\n### `node.format()` \u0026 `node.render()`\n\nThe `node.format` \u0026 `node.render` methods, help user to avoid handle `Node` recursively.\n\n- `node.format()` -- format `node` back to markdown itself.\n- `node.render()` -- render `node` to html.\n\n## Development\n\n```\nnpm install    // Install dependencies\nnpm run build  // Compile `src/` to `lib/`\nnpm run watch  // Watch the compilation\nnpm run test   // Run test\n```\n\n## Contributions\n\n\u003e Be polite, do not bring negative emotion to others.\n\n- [TODO.md](TODO.md)\n- [STYLE-GUIDE.md](STYLE-GUIDE.md)\n- [CODE-OF-CONDUCT.md](CODE-OF-CONDUCT.md)\n- When contributing, add yourself to [AUTHORS](AUTHORS)\n\n## License\n\n- [GPLv3](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxieyuheng%2Fpostmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxieyuheng%2Fpostmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxieyuheng%2Fpostmark/lists"}