vincentbel / remark-pangu Goto Github PK
View Code? Open in Web Editor NEW给 Markdown 中英文自动插入空格的 remark 插件
License: MIT License
给 Markdown 中英文自动插入空格的 remark 插件
License: MIT License
remark()
.use(pangu)
.process(newContent, (err, result) => {
if (err) {
return Promise.reject(err);
}
newContent = String(result);
});
会把头部的 (frontmatter?)
---
pageClass: routes
---
弄得很奇怪
请问有没有解决办法?
下面有些常见的用例,如果用 pangu 格式化会失去原来了的含义。
输入:
`JSON.stringify({'test': '值test'})`
`./新建文件夹/node_modules/remark-pangu/index.js`
`printf("a = %d, b = %d\n", a, b); // 打印 a 和 b`
经过 pangu 格式化输出:
`JSON.stringify ({'test': ' 值 test'})`
`./ 新建文件夹 /node_modules/remark-pangu/index.js`
`printf ("a = % d, b = % d\n", a, b); // 打印 a 和 b`
$$
X_3^2
$$
会变成
$$
X\_3^2
$$
internal/modules/cjs/loader.js:1023
throw err;
^
Error: Cannot find module './set-options'
Require stack:
- node_modules/remark-pangu/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1020:15)
at Function.Module._load (internal/modules/cjs/loader.js:890:27)
at Module.require (internal/modules/cjs/loader.js:1080:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/node_modules/remark-pangu/index.js:6:20)
at Module._compile (internal/modules/cjs/loader.js:1176:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
at Module.load (internal/modules/cjs/loader.js:1040:32)
at Function.Module._load (internal/modules/cjs/loader.js:929:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'node_modules/remark-pangu/index.js'
]
}
Released package
➜ remark-pangu ls
index.js LICENSE node_modules package.json README.md
master
branch failed. 🚨I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.
You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.
Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master
branch. You can also manually restart the failed CI job that runs semantic-release.
If you are not sure how to resolve this, here is some links that can help you:
If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.
The npm token configured in the NPM_TOKEN
environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/
.
If you are using Two-Factor Authentication, make configure the auth-only
level is supported. semantic-release cannot publish with the default auth-and-writes
level.
Please make sure to set the NPM_TOKEN
environment variable in your CI with the exact value of the npm token.
Good luck with your project ✨
Your semantic-release bot 📦🚀
出于对于内容的考量, 希望在排版的时候排除inline_code
是否可以提供一个设定开关(preset
)控制排版的内容?
e.g.
remark().use(pangu, {
inlineCode: false
}).process(doc, (err, file) => {
console.log(String(file));
});
对于形如 https://rsshub.app/bilibili/fav/2267573/801952073?filter=编曲|摄影
这样的链接
会自动给他的text部分加上空格, 这种行为该如何避免?
还有就是如果 md 中包含 html 的 node 是不是可以直接也处理掉, 直接传给 pangu
就好了
这个情况应该是可以处理的?
在设置了 { inlineCode: true }
以后,也不会在反引号 "`" 与中文之间加上空格,如
中文`abc`中文
预期的效果是
中文 `abc` 中文
但是没有见效。
const remark = require('remark');
const pangu = require('remark-pangu');
const doc = '[https://myactivity.google.com](https://myactivity.google.com)';
remark()
.use(pangu)
.process(doc, (err, file) => {
console.log(String(file));
});
// => <https://myactivity.google.com>
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.