{"_id":"@1-/md2htm","name":"@1-/md2htm","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.1":{"name":"@1-/md2htm","version":"0.1.1","description":"Lightweight Markdown-to-HTML converter with AST-based parsing and semantic HTML generation.","keywords":["ast","converter","html","markdown","parser"],"homepage":"https://github.com/webc-site/npm/tree/main/md2htm","license":"MulanPSL-2.0","author":{"name":"x-at-01@googlegroups.com"},"repository":{"type":"git","url":"git+https://github.com/webc-site/npm.git"},"type":"module","exports":{".":"./_.js","./*":"./*"},"_id":"@1-/md2htm@0.1.1","bugs":{"url":"https://github.com/webc-site/npm/issues"},"_nodeVersion":"26.2.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-OOTi4Iapa+TPkrOTK8QorRcg7q/2HfCRme50TDfaHKga6IBkVXb/kNZilFk3FJHzPHoId5FGXqIn0fPcLdqSZQ==","shasum":"eb28221f847f1da7f349084102212181f5f29331","tarball":"https://registry.npmjs.org/@1-/md2htm/-/md2htm-0.1.1.tgz","fileCount":8,"unpackedSize":55554,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEQIjCBKlEoOFasoOloOECx5NYOmZn0Ai8+FayfCNHm8AiEA1OcMI3BMA/2Uc8DhrenNk45jUD89STZ5/u8K2cCfqbo="}]},"_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"directories":{},"maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/md2htm_0.1.1_1787193483786_0.16282677575163174"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-20T02:38:03.573Z","0.1.1":"2026-08-20T02:38:03.940Z","modified":"2026-08-20T02:38:04.217Z"},"maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"description":"Lightweight Markdown-to-HTML converter with AST-based parsing and semantic HTML generation.","homepage":"https://github.com/webc-site/npm/tree/main/md2htm","keywords":["ast","converter","html","markdown","parser"],"repository":{"type":"git","url":"git+https://github.com/webc-site/npm.git"},"author":{"name":"x-at-01@googlegroups.com"},"bugs":{"url":"https://github.com/webc-site/npm/issues"},"license":"MulanPSL-2.0","readme":"[English](#en) | [中文](#zh)\n\n---\n\n<a id=\"en\"></a>\n# md2htm : Lightweight Markdown-to-HTML Converter\n\n- [md2htm : Lightweight Markdown-to-HTML Converter](#md2htm-lightweight-markdown-to-html-converter)\n  - [Functionality](#functionality)\n  - [Usage Example](#usage-example)\n  - [Design Approach](#design-approach)\n  - [Technology Stack](#technology-stack)\n  - [Code Structure](#code-structure)\n  - [Historical Context](#historical-context)\n  - [About](#about)\n\n## Functionality\n\nConverts Markdown text to semantic HTML output. Supports standard Markdown syntax plus extensions including admonition blocks (`[!NOTE]`, `[!TIP]`, `[!IMPORTANT]`, `[!WARNING]`, `[!CAUTION]`), math notation (`<c-math>`), and GitHub-style tables with alignment support.\n\n## Usage Example\n\n```javascript\nimport md2htm from \"@1-/md2htm\";\n\nconst markdown = \"# Hello\\n\\nThis is **bold** text.\\n\\n[!NOTE]\\nThis is an admonition block.\";\nconst html = md2htm(markdown);\n// Returns semantic HTML with proper class attributes and structure\n```\n\n## Design Approach\n\nThe converter implements a three-stage pipeline:\n\n![](https://cdn.jsdmirror.com/gh/webc-fs/-@pz/LqGjMOAS0NkOIEWOJDzg.svg)\n\nKey implementation features:\n\n- Memory-efficient AST using integer-based node types (`T_H=2`, `T_P=3`, etc.)\n- Streaming parsing that processes text line-by-line\n- Custom HTML encoding/decoding with comprehensive entity support\n- Admonition block detection and semantic class generation (`<blockquote class=\"q note\">`)\n- Math notation support with `<c-math>` custom elements\n- GitHub-style table alignment support (`left`, `center`, `right`)\n\n## Technology Stack\n\n- Pure JavaScript ES modules (no external dependencies)\n- Custom AST-based parsing engine\n- Semantic HTML generation with accessibility considerations\n- Comprehensive HTML entity decoding (17+ entities supported)\n- Safe URL encoding with RFC-compliant handling\n\n## Code Structure\n\n```\nsrc/\n├── _.js          # Main entry point with default export\n├── ast.js        # Core parser with streaming architecture\n├── lib.js        # AST-to-HTML coordinator\n├── renderBlock.js # Block-level renderer\n├── htmD.js       # HTML decoder with entity mappings and punctuation handling\n└── htmE.js       # HTML encoder with 4-character entity escaping\n```\n\n## Historical Context\n\nMarkdown was created by John Gruber in 2004 to enable easy-to-read, easy-to-write plain text formatting. Aaron Swartz provided critical feedback on its syntax design. This md2htm implementation continues that tradition with modern optimizations, using integer-based AST nodes for memory efficiency and streaming parsing for performance.\n\n## About\n\nThis library is developed by [WebC.site](https://webc.site).\n\n[WebC.site](https://webc.site): A new paradigm of web development for AI\n\n\n---\n\n<a id=\"zh\"></a>\n# md2htm : 轻量级 Markdown 到 HTML 转换器\n\n- [md2htm : 轻量级 Markdown 到 HTML 转换器](#md2htm-轻量级-markdown-到-html-转换器)\n  - [功能介绍](#功能介绍)\n  - [使用演示](#使用演示)\n  - [设计思路](#设计思路)\n  - [技术栈](#技术栈)\n  - [代码结构](#代码结构)\n  - [历史故事](#历史故事)\n  - [关于](#关于)\n\n## 功能介绍\n\n将 Markdown 文本转换为语义化 HTML 输出。支持标准 Markdown 语法及扩展功能，包括警示块（`[!NOTE]`、`[!TIP]`、`[!IMPORTANT]`、`[!WARNING]`、`[!CAUTION]`）、数学符号（`<c-math>`）以及带对齐支持的 GitHub 风格表格。\n\n## 使用演示\n\n```javascript\nimport md2htm from \"@1-/md2htm\";\n\nconst markdown = \"# 你好\\n\\n这是 **粗体** 文字。\\n\\n[!NOTE]\\n这是一个警示块。\";\nconst html = md2htm(markdown);\n// 返回具有正确类属性和结构的语义化 HTML\n```\n\n## 设计思路\n\n转换器采用三阶段流水线架构：\n\n![](https://cdn.jsdmirror.com/gh/webc-fs/-@a3/GznoCvTM75cGCnlq4h7A.svg)\n\n关键实现特性：\n\n- 内存高效 AST，使用整数节点类型（`T_H=2`、`T_P=3` 等）\n- 流式解析，逐行处理文本\n- 自定义 HTML 编码/解码，支持 17+ 实体映射\n- 警示块检测与语义化类生成（`<blockquote class=\"q note\">`）\n- 数学符号支持 `<c-math>` 自定义元素\n- GitHub 风格表格对齐支持（`left`、`center`、`right`）\n\n## 技术栈\n\n- 纯 JavaScript ES 模块（无外部依赖）\n- 自定义 AST 解析引擎\n- 语义化 HTML 生成，考虑可访问性\n- 完整 HTML 实体解码（支持 17+ 实体）\n- 符合 RFC 规范的安全 URL 编码\n\n## 代码结构\n\n```\nsrc/\n├── _.js          # 主入口文件，提供默认导出\n├── ast.js        # 核心解析器，含流式架构\n├── lib.js        # AST 到 HTML 协调器\n├── renderBlock.js # 块级渲染器\n├── htmD.js       # HTML 解码器，含实体映射和标点处理\n└── htmE.js       # HTML 编码器，4 字符实体转义\n```\n\n## 历史故事\n\nMarkdown 由 John Gruber 于 2004 年创建，旨在提供易读易写的纯文本格式化方案。Aaron Swartz 对其语法设计提供了关键反馈。本 md2htm 实现延续这一传统，采用现代优化技术：使用整数型 AST 节点提升内存效率，流式解析增强性能。\n\n## 关于\n\n本库由 [WebC.site](https://webc.site) 开发。\n\n[WebC.site](https://webc.site) : 面向人工智能的网站开发新范式\n\n","readmeFilename":"README.md","_rev":"1-5f7e3729262312e8f6f1026f729400b0"}