马克德林特-吉图布
这个寄存器提供了 GitHub 的推荐 markdownlint 配置,以及用于GitHub开源和内部项目的附加规则.
意见
除以 markdownlint,我们使用这个寄存器来强制实施未默认定义的规则,包括我们自己的自定义规则.
见编纂的意见 指数.js。 。 。 .
规则
以下是此插件中定义的自定义规则 .
见 markdownlint 规则 关于规则的文件 markdownlint。 。 。 .
使用量
重要:我们支持使用 markdownlint 结束 markdownlint-cli2 改为 markdownlint-cli 的兼容性 vscode-markdownlint 插件 .
-
创建一个
.markdownlint-cli2.mjs中的文件.touch .markdownlint-cli2.mjs -
安装软件包 .
npm install -D markdownlint-cli2 # if updating existing package, check for updates npm install -D @github/markdownlint-github [--@github:registry=https://registry.npmjs.org] npm install -D markdownlint-cli2-formatter-pretty -
添加/ 修改您的嵌入脚本
package.json。 。 。 ."scripts": { "lint:markdown": "markdownlint-cli2 \"**/*.{md,mdx}\" \"!node_modules\"" } -
编辑
.markdownlint-cli2.mjs以适应您的需要。 开始import markdownIt from "markdown-it" import configOptions, {init} from "@github/markdownlint-github" const markdownItFactory = () => markdownIt({ html: true }) const options = { config: init(), customRules: ["@github/markdownlint-github"], markdownItFactory, outputFormatters: [ [ "markdownlint-cli2-formatter-pretty", { "appendLink": true } ] // ensures the error message includes a link to the rule documentation ] } export default options或者,您也可以通过您想要覆盖默认的配置选项。 更多信息 自定义配置。 。 。 . 这看起来像:
import markdownIt from "markdown-it" import configOptions, {init} from "@github/markdownlint-github" const overriddenOptions = init({ 'fenced-code-language': false, // Custom overrides }) const markdownItFactory = () => markdownIt({ html: true }) const options = { config: overriddenOptions, customRules: ["@github/markdownlint-github"], markdownItFactory, outputFormatters: [ [ "markdownlint-cli2-formatter-pretty", { "appendLink": true } ] ] } export default options -
安装
vscode-markdownlint确保的插件markdownlint违反情况在档案中出现。 此插件应该基于您的规则.markdownlint-cli2.mjs配置 。 当编辑到您的配置时, 您需要重新装入 VSCode 窗口(Ctrl+Shift+P- > (中文)Reload Window),以确保扩展同步. 如果您的工程运行在代码空间上, 请考虑在您的.devcontainer/devcontainer.json这样,这个扩展默认会安装到新的代码空间.
自定义配置
您可以确定此插件设置的默认不适合您的工程 .
此插件将在定义的默认值中拉动 markdownlint,其中几个与形式做法有关。 如果您确定这些规则不能为您的工程提供价值, 您可以选择禁用这些规则 .
但是,这些规则的其他条款应当 没有 残疾,因为它们鼓励最佳无障碍做法。 使这些规则失效将对无障碍环境产生不利影响。 这些规则的定义载于 无障碍。 。 。 .
审查由 markdownlint,参见 markdownlint-cli2 配置。 。 。 .
高级: 在代码库中添加自定义规则
您可以在您的仓库里写自定义规则 。 跟着 自定义规则指南 markdownlint 写你的规则.
在配置中需要启用规则 。 例如,如果你介绍 some-rule.js 名称“ some- rule ” , 您必须在 .markdownlint-cli2.mjs 文件 :
import configOptions, {init} from "@github/markdownlint-github"
import markdownIt from "markdown-it"
const markdownItFactory = () => markdownIt({ html: true })
const options = init({
"some-rule": true,
customRules: ["@github/markdownlint-github", "some-rule.js"],
markdownItFactory
})
export default options
见 markdownlint-cli2 配置。 。 。 .
考虑将您认为有用的任何规则上游化, 作为向此存储库提出的建议 .
许可证
这个项目根据麻省理工学院开源许可证的规定获得许可. 请 参考 麻省理工学院执照 全部条件.
维护者
见 消费者。 。 。 .
捐款
请阅读 贡献指南 更多信息.