GithubHelp home page GithubHelp logo

vincentbel / remark-pangu Goto Github PK

View Code? Open in Web Editor NEW
26.0 3.0 9.0 207 KB

给 Markdown 中英文自动插入空格的 remark 插件

License: MIT License

JavaScript 100.00%
remark remark-plugin pangu text-spacing

remark-pangu's People

Contributors

curbengh avatar dependabot[bot] avatar diamondyuan avatar neverbehave avatar vincentbel avatar zjffun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

remark-pangu's Issues

markdown 头部格式的问题

        remark()
            .use(pangu)
            .process(newContent, (err, result) => {
                if (err) {
                    return Promise.reject(err);
                }
                newContent = String(result);
            });

会把头部的 (frontmatter?)

---
pageClass: routes
---

弄得很奇怪

image

image

请问有没有解决办法?

DIYgod/RSSHub#4654 (comment)

是否应该默认禁止格式化行内代码块的内容?

下面有些常见的用例,如果用 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`

package.json does not include al necessary files

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

The automated release is failing 🚨

🚨 The automated release from the 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.


Invalid npm token.

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));
});

中文链接处理&HTML

对于形如 https://rsshub.app/bilibili/fav/2267573/801952073?filter=编曲|摄影 这样的链接
会自动给他的text部分加上空格, 这种行为该如何避免?

还有就是如果 md 中包含 html 的 node 是不是可以直接也处理掉, 直接传给 pangu 就好了
这个情况应该是可以处理的?

对行内代码块没有作用

在设置了 { inlineCode: true } 以后,也不会在反引号 "`" 与中文之间加上空格,如

中文`abc`中文

预期的效果是

中文 `abc` 中文

但是没有见效。

有一个比较小白的问题

该怎么使用这个插件呢?
我已经安装完成了图片
下边的使用过程我看不太懂,或许有人可以教我以下,
我在终端输入remark().use(pangu)后报错了
图片

如果是链接,会有问题。

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>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.