zhlint-project / zhlint Goto Github PK
View Code? Open in Web Editor NEWA linting tool for Chinese language.
Home Page: https://zhlint.jinjiang.dev/
License: MIT License
A linting tool for Chinese language.
Home Page: https://zhlint.jinjiang.dev/
License: MIT License
https://hexo.io/docs/tag-plugins.html
{% raw %}
content
{% endraw %}
{% blockquote [author[, source]] [link] [source_link_title] %}
content
{% endblockquote %}
{% codeblock [title] [lang:language] [url] [link text] [additional options] %}
code snippet
{% endcodeblock %}
{% pullquote [class] %}
content
{% endpullquote %}
{% jsfiddle shorttag [tabs] [skin] [width] [height] %}
{% gist gist_id [filename] %}
{% iframe url [width] [height] %}
{% img [class names] /path/to/image [width] [height] '"title text" "alt text"' %}
{% link text url [external] [title] %}
{% include_code [title] [lang:language] [from:line] [to:line] path/to/file %}
{% youtube video_id %}
{% vimeo video_id [width] [height] %}
{% post_path filename %}
{% post_link filename [title] [escape] %}
{% asset_path filename %}
{% asset_img filename [title] %}
{% asset_link filename [title] [escape] %}
如题:用 zhlint 解析部分空格的处理结果不正确
a* 啊 *
a *啊*
(结尾有一个空格)a *啊*
* 啊 *
* 啊*
(内部多了一个空格)*啊*
版本 v0.5.1
zhlint 支持一些简单的 rule 配置,然而,事实上目前内部已有的 rule 对用户并不友好,更多的是基于实现的角度节藕而已,与目前普遍的中文格式配置需求存在差异
支持配置文件,暂约定为 .zhlintrc
,格式暂约定为 JSON。支持一些对用户需求友好的配置,背后与现有的 rule 的实现和内部配置项进行二次适配。
TODO:具体的 rc 文件配置项待设计
另外也可以考虑同时
package.json
中通过一个 zhlint
的字段进行配置。... like <!-- zhlint disable -->
对于 ..
文本会抛出异常 TypeError: Cannot read property 'validations' of undefined
示例:# 简介 {#introduction}
# 简介{ #introduction}
+ error report: "There should be no space before a punctuation."# 简介 {#introduction}
底层重构
API 更新
文档更新
e.g.
::: warning 警告
随便写点什么
:::
Will lead to the error:
The puncatuation
:
should be full-width as:
.
yarn global add zhlint
然后在测试运行某个文件的时候:
zhlint ./test/hh.md
出现报错: ReferenceError: invalidFiles is not defined
--- 补充 ---
看了一下应该是 #L72 出现了问题,参数没有定义,建议加上 eslint
工具
'3 minite(s) left'
false
|'left'
|'right'
|'both'
|'keep'
'2019-06-26 12:00'
, '2019年06月26号'
(测试 GitHub Tasklist)
### v0.7.1
- [ ] #58
- [ ] #79
- [ ] #77
- [ ] #91
stdout
and stderr
--validate
(exit code)--fix
我在配置 https://github.com/freeCodeCamp/news-translation Lint Action 时遇到很多如下报错:
Unmatched closed bracket ) at xxx
发现报错附近一定有 ASCII 表情(如 ;-)
)或二级数字列表号(如 1)
)等英语习惯用法,这会让英译中工作者非常抓狂……
e.g.
xx.md
内容为:1-1
执行 zhlint xx.md
出现以下错误
[start] xxxx.md
TypeError: Cannot read property 'content' of undefined
at module.exports (/Users/lily/.nvm/versions/node/v13.3.0/lib/node_modules/zhlint/src/rules/case-math-exp.js:56:60)
at travel (/Users/lily/.nvm/versions/node/v13.3.0/lib/node_modules/zhlint/src/travel.js:21:7)
at processRule (/Users/lily/.nvm/versions/node/v13.3.0/lib/node_modules/zhlint/src/process-rule.js:17:3)
at /Users/lily/.nvm/versions/node/v13.3.0/lib/node_modules/zhlint/src/run.js:127:52
at Array.forEach (<anonymous>)
at /Users/lily/.nvm/versions/node/v13.3.0/lib/node_modules/zhlint/src/run.js:127:36
at Array.map (<anonymous>)
at run (/Users/lily/.nvm/versions/node/v13.3.0/lib/node_modules/zhlint/src/run.js:124:54)
at /Users/lily/.nvm/versions/node/v13.3.0/lib/node_modules/zhlint/bin/index.js:35:39
at Array.map (<anonymous>)
如题
因为 zhlint
命令目前要求输入文件是第一个参数,导致 zhlint --fix
无法如 eslint --fix
般用在 lint-staged
……
e.g.
> [Live Demo ](https://vue-hn.herokuapp.com/)
> 注:如果在一段时间内没有人访问过该网站,则需要一些加载时间。
>
目前,在 error report 中,我们会先打印原文片段,然后在第二行适当位置放一个 caret (^) 以示更精确的错误位置。
由于中英文的字符宽度不同,所以为了让 caret 显示在第二行正确的位置,目前的实现方式是在第二行先用黑色字和黑色背景色把 caret 之前的所有文本渲染一遍 (因为全是黑色的所以视觉上看不出来),不论是中文还是英文,这样再渲染一个 caret,就可以对齐在想要的位置。但其实这个方案不够好,因为不是所有的命令行背景都是黑色的,这个假设其实不成立,另外在不支持配色的命令行环境下,大家会看到类似这样的 error report
自动在中文和English之间加入空格
自动在中文和^
把 caret 之前的输出换位全角空格和半角空格。具体做法是,先数一下 caret 之前有几个半角字符,几个全角字符,然后在第二行输出相应数量的半角空格和全角空格,然后输出一个 caret
遇到英文整句且标点符号是当前行的最后一个字符时,当前规则下也要求使用全角符号。比如:
Blabla.
Haha.
check时 会要求.
使用全角符号,这个和 https://github.com/sparanoid/chinese-copywriting-guidelines/blob/master/README.zh-Hans.md 以及其他的一些lint 检测规则冲突,这个是否需要优化下 ^_^
如题:用 zhlint 解析 x‘x’x
会出错
Uncaught Error: Unmatched closed quote at 0
at to (/xxx/zhlint/dist/zhlint.umd.js:1:6792)
at /xxx/zhlint/dist/zhlint.umd.js:52:19518
at Array.map (<anonymous>)
at Up (/xxx/zhlint/dist/zhlint.umd.js:52:19467)
版本 v0.5.1
由目前的 src/hypers/vuepress.ts
更换为:https://github.com/markdown-it/markdown-it-container
更新:由于 markdown-it 短期无法支持提供 token position 信息,所以决定继续使用 remark + https://www.npmjs.com/package/remark-custom-container
储存档案时能自动补正的话那是美滋滋的。或许有空支援下 NeoVim 吧
zhlint is awesome! but I also want use it in vscode to lint Zh, and it will be very powerful when we support it in vscode and use quick fix to correct Zh.
Should be computed()
, which now is computed ()
.
摘自 Vue 中文翻译 wiki
- 在加粗段落,仅当影响 markdown 渲染情况下,将最后一个句号或逗号、冒号,迁移到
**
右侧,否则保持原样。(讨论:vuejs/docs-next-zh-cn#49、vuejs/docs-next-zh-cn#78)// 情况1: **相对胜于晦涩。**例如,一个 `<BlogPost>` 组件例子比 `<CurrencyExchangeSettings>` 更好。 // vuepress 无法渲染 (调整为:) **相对胜于晦涩**。例如,一个 `<BlogPost>` 组件例子比 `<CurrencyExchangeSettings>` 更好。 // 迁移句号有加粗符号右侧 // 情况2:不影响渲染,保持原样 **你好,世界。** ==> **你好,世界。** (不影响渲染,保持原样)
该判断逻辑技术上的难点是需要在 markdown parser 处理之前进行分析和修正。目前 zhlint 暂不支持,且并没有深入到 markdown parser 的定制当中。
如果要做的话,处理逻辑和 zhlint 的其它功能之间应该也是相对独立的。
解决方案待讨论
更多示例记录:
异步组件默认就是 **“suspensible”** 的
e.g.
<p class="tip">如果 `render` 函数和 `template` property都不存在,挂载 DOM 元素的 HTML 会被提取出来用作模板,此时,必须使用 Runtime + Compiler 构建的 Vue 库。</p>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.