Hexo-Renderer-Markdown-It-Plus 使用教程

Hexo-Renderer-Markdown-It-Plus 使用教程

hexo-renderer-markdown-it-plusMarkdown-it is a markdown parser, done right. A faster and CommonMark compliant alternative for Hexo.项目地址:https://gitcode.com/gh_mirrors/he/hexo-renderer-markdown-it-plus

1. 项目的目录结构及介绍

hexo-renderer-markdown-it-plus/
├── lib/
│   ├── index.js
│   └── ...
├── test/
│   ├── index.js
│   └── ...
├── .eslintignore
├── .eslintrc
├── .gitattributes
├── .gitignore
├── .mocharc.yml
├── LICENSE
├── README.md
├── index.js
├── package.json
└── yarn.lock
  • lib/: 包含项目的主要逻辑文件。
  • test/: 包含项目的测试文件。
  • .eslintignore: ESLint 忽略配置文件。
  • .eslintrc: ESLint 配置文件。
  • .gitattributes: Git 属性配置文件。
  • .gitignore: Git 忽略配置文件。
  • .mocharc.yml: Mocha 测试框架配置文件。
  • LICENSE: 项目许可证文件。
  • README.md: 项目说明文件。
  • index.js: 项目的入口文件。
  • package.json: 项目的依赖和脚本配置文件。
  • yarn.lock: Yarn 包管理器锁定文件。

2. 项目的启动文件介绍

项目的启动文件是 index.js,它作为入口文件,负责初始化和配置 Markdown-it 渲染引擎。以下是 index.js 的主要内容:

const markdownIt = require('markdown-it');
const markdownItPlus = require('./lib/index');

module.exports = function(hexo) {
  const config = hexo.config.markdown || {};
  const md = markdownIt(config);
  markdownItPlus(md, hexo);
  hexo.extend.renderer.register('md', 'html', function(data, options) {
    return md.render(data.text, options);
  });
};
  • markdownIt: 引入 Markdown-it 库。
  • markdownItPlus: 引入自定义的 Markdown-it 插件。
  • module.exports: 导出函数,用于 Hexo 的渲染器注册。

3. 项目的配置文件介绍

项目的配置文件主要是 package.json,它包含了项目的依赖、脚本和其他元数据。以下是 package.json 的主要内容:

{
  "name": "hexo-renderer-markdown-it-plus",
  "version": "1.0.0",
  "description": "Markdown-it is a markdown parser done right. A faster and CommonMark compliant alternative for Hexo.",
  "main": "index.js",
  "scripts": {
    "test": "mocha"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/CHENXCHEN/hexo-renderer-markdown-it-plus.git"
  },
  "keywords": [
    "hexo",
    "markdown",
    "markdown-it",
    "renderer"
  ],
  "author": "CHENXCHEN",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/CHENXCHEN/hexo-renderer-markdown-it-plus/issues"
  },
  "homepage": "https://github.com/CHENXCHEN/hexo-renderer-markdown-it-plus#readme",
  "dependencies": {
    "markdown-it": "^12.0.0",
    "markdown-it-plus": "^1.0.0"
  },
  "devDependencies": {
    "mocha": "^9.0.0"
  }
}
  • name: 项目名称。
  • version: 项目版本。
  • description: 项目描述。
  • main: 入口文件。
  • scripts: 脚本命令,如测试命令 npm test
  • repository: 项目仓库地址。
  • keywords: 项目关键词。
  • author: 项目作者。
  • license: 项目许可证。
  • bugs: 问题跟踪地址。
  • homepage: 项目主页。
  • dependencies: 项目依赖。
  • devDependencies: 开发依赖

hexo-renderer-markdown-it-plusMarkdown-it is a markdown parser, done right. A faster and CommonMark compliant alternative for Hexo.项目地址:https://gitcode.com/gh_mirrors/he/hexo-renderer-markdown-it-plus

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

符卿玺

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值