{"id":19577389,"url":"https://github.com/hangxingliu/mdjs","last_synced_at":"2025-06-23T15:36:32.122Z","repository":{"id":57293226,"uuid":"47205655","full_name":"hangxingliu/mdjs","owner":"hangxingliu","description":":green_book: A Lightweight Markdown Parser (JavaScript)","archived":false,"fork":false,"pushed_at":"2021-11-11T06:14:48.000Z","size":462,"stargazers_count":28,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-16T22:53:53.661Z","etag":null,"topics":["javascript","markdown","parser"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hangxingliu.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}},"created_at":"2015-12-01T17:23:03.000Z","updated_at":"2024-05-04T02:05:15.000Z","dependencies_parsed_at":"2022-09-01T06:40:33.993Z","dependency_job_id":null,"html_url":"https://github.com/hangxingliu/mdjs","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/hangxingliu/mdjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hangxingliu%2Fmdjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hangxingliu%2Fmdjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hangxingliu%2Fmdjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hangxingliu%2Fmdjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hangxingliu","download_url":"https://codeload.github.com/hangxingliu/mdjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hangxingliu%2Fmdjs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261505436,"owners_count":23169036,"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":["javascript","markdown","parser"],"created_at":"2024-11-11T07:06:11.675Z","updated_at":"2025-06-23T15:36:32.093Z","avatar_url":"https://github.com/hangxingliu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mdjs\n\n[![Build Status](https://travis-ci.org/hangxingliu/mdjs.svg?branch=master)](https://travis-ci.org/hangxingliu/mdjs)\n\n\u003e Mdjs is a lightweight Markdown parser for JavaScript\n\u003e  (一个轻量级的 Markdown 解析器)   \n\u003e **Demo**: \u003chttp://hangxingliu.github.io/mdjs.editor/\u003e   \n\u003e **Mdjs.editor**: \n\u003e [Github](https://github.com/hangxingliu/mdjs.editor)\n\u003e [Git@OSC](http://git.oschina.net/voyageliu/mdjs.editor)\n\n---\n\n## Latest version (目前版本)\n\n### 1.0.5\n\n2021-11-05\n\n- 修复了URL转译问题\n- 修复了链接的title的问题\n- 修复了HTML注释的问题\n\n\n更多更新日志请参阅: [CHANGELOG.md](documents/CHANGELOG.md)\n\n## Usage (使用)\n\n### Web frontend (Web 前端)\n\n``` html\n\u003c!-- 不依赖其他任何库,仅一个脚本文件即可 --\u003e\n\u003cscript src=\"mdjs.min.js\" type=\"text/javascript\" charset=\"utf-8\"\u003e\u003c/script\u003e\n```\n\n``` javascript\n//方法一\nvar html = Mdjs.md2html(markdownText);\n//方法二\nvar mdjs = new Mdjs();\nvar html = mdjs.md2html(markdownText);\n```\n\n### Node.js\n\n``` bash\nnpm i md-js\n```\n\n``` javascript\n//方法一\nvar Mdjs = require('md-js');\nvar html = Mdjs.md2html(markdownText);\n//方法二\nvar Mdjs = require('md-js').Mdjs;\nvar mdjs = new Mdjs();\nvar html = mdjs.md2html(markdownText);\n```\n\n### Options for parser (配置解析选项)\n\n``` javascript\nvar mdjs = new Mdjs();\nvar html = mdjs.md2html(markdownText, {\n\t//markdown 文本中表示段落的每行行末都加入 换行标签\u003cbr/\u003e\n\talwaysNewline: false\n});\n```\n\n### Custom render rules (自定义渲染规则)\n\n``` javascript\n//创建自定义渲染器类\nvar myRender = new Mdjs.MdjsRenderer();\n//配置自定义引用区块的HTML标签\nmyRender.tag.quote = ['\u003cdiv class=\"blockquote\"\u003e', '\u003c/div\u003e'],\n//配置自定义邮箱部分的 HTML 生成函数\nmyRender.func.email = function(email){\n\treturn '\u003ca href=\"mailto:' + email + '\"\u003e' + email + '\u003c/a\u003e';\n};\n//自定义链接参考式\nmyRender.addRefLinkProvider(function(referName) {\n\treturn { url: 'https://github.com/' + referName };\n});\nvar mdjs = new Mdjs(myRender);\nvar html = mdjs.md2html(markdownText);\n```\n\n更多自定义渲染规则请参阅: [CUSTOM_RENDER.md](documents/CUSTOM_RENDER.md)\n\n\n## Features (语法支持)\n\n目前广泛使用的的Markdown语法都能被解析,\n额外支持的语法还有:\n\n- `脚注`\n- `表格`\n- `[toc]`\n\n暂不支持的语法和功能:\n\n- `选项框`\n- `流程图,时序图和LaTeX公式`\n- `代码块的高亮`\n\n## Maintenance manual (开发维护手册)\n\n参考学习或开发维护可参考文档:\n[DEVELOP_MANUAL.md](documents/DEVELOP_MANUAL.md)\n\n## Author (作者)\n\n@hangxingliu (Liu Yue)   \n[Github](https://github.com/hangxingliu)   \n[码云Gitee](https://git.oschina.net/voyageliu)   \n\n## License (开源协议)\n\n[Apache Licence 2.0](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhangxingliu%2Fmdjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhangxingliu%2Fmdjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhangxingliu%2Fmdjs/lists"}