GithubHelp home page GithubHelp logo

harttle / md-padding Goto Github PK

View Code? Open in Web Editor NEW
50.0 3.0 5.0 1.24 MB

修复 Markdown 中的混排空格:中英文、数字、链接等。

Home Page: https://harttle.land/md-padding/

JavaScript 2.69% TypeScript 97.31%
markdown padding typeset fixer

md-padding's People

Contributors

dependabot[bot] avatar harttle avatar obgnail avatar semantic-release-bot avatar stephanogeorge 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  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

md-padding's Issues

vscode MPE 图片导入语句格式化后失败问题

使用 vscode MPE(Markdown Preview Enhanced) 插件的导入图片并设置大小。
@import "image.png" {width="300px" alt="image"}
经过 md padding 格式化之后,由于在width 和 alt 之后加了一个空格,变成了
@import "image.png" {width = "300px" alt = "image"}
图片的解析失败了。

还有表示文件名的 "image.png" 中如果有中文的话,也会导致文件路径改变 ,而文件找不到。

建议加入关于行内公式的识别

  1. 行内公式前后添加可以空格,因为习惯用Tex形式的字母和数字(😂😂😂)
  2. 目前行内公式的*符号会和外部的加粗,斜体等产生一些空格导致的BUG
其实就类似我们学过的科学计数法,其一般形式为$N = S*r^j$,其中$S$称为**尾数**,$j$称为**阶码**,$r$称为**基值**
其实就类似我们学过的科学计数法,其一般形式为$N = S *r^j$,其中$S$称为* *尾数* *,$j$称为* *阶码* *,$r$称为* *基值**

关于格式的几个疑问

首先我是这么用的:

image

代码片段里方法的注释格式化的是不是有问题呀

image

还有,关于数组的访问为什么也加了空格呀,这个可不可以做成一个配置,比如我只在代码写 "[" ,正文一般不用这种括号,所以我不需要在我的 "[" 前面加空格,看能不能提供白名单功能

image

感谢博主,周末愉快

是否考虑支持 .mdx 文件

先感谢作者的无私奉献。

现在很多框架会使用 MD 的扩展文件 MDX 生成文档,里面可能包含少量的特殊语法,但特殊语法是需要内部程序去转换的特殊标记,一般都是固定的英文,也不需要任何处理,但绝大部分内容还是按照 Markdown 语法写的,是否考虑支持这种 .mdx 文件?

我使用的方式是 VS Code 插件,目前检测到 .mdx 文件插件不会生效,建议允许此文件类型生效,可能不能完美处理,但有总比没有好。我目前刚好需要处理很多 MDX 文件。

should recognize UnorderedListItem with * prefix in blockquote

开发者你好,发现一个 BUG。

对于以下文本,解析是有问题的

> * **测试**

因为 md-padding 并没有解析 blockquote,而是讨巧的把 > 解析为 Punctuation,因此,会把第一和第二个星号解析为斜体,但是其本意应该为一个无序列表:

  • 测试

能否增加当前路径下递归查找指定格式文件的功能?

如果需要处理大量不同路径的文本,目前我用的管道命令效率太低,现在默认的管道命令我用起来不支持参数 - i (也可能是我不会用),我现在是这么用的:

find "$(pwd)" -type f -name "*.md" | xargs -I {} npx mdp -i {}

这样效率太低了,需要十几分钟才能处理完 2000+ 文本。

能否在程序中原生支持查找当前路径及递归目录中的指定格式的文件?

非常感谢。

能否给与参数不处理英文之间的符号问题,或者不对特定英文标点进行处理

例如:

* –––, 2023, “Practicing *ubuntu*,” *The Philosophical Forum*, 54: 143–159. doi:10.1111/phil.12338

会自动在 doi:10.1111 的冒号后加空格,这是 doi 引用规范,不能更改。

对于英文的 Markdown 处理也存在一些问题。会在 *: 符号前后加空格,造成 Markdown 语法识别错误或者影响引用规范。

比如某些数学公式存在比值 ::,例如 4:2::2:11:2

should recognize blockCode nested in UnorderedList correctly

开发者你好,发现一个 BUG。

当代码块嵌套于无序列表时,代码块将会解析错误,导致后续的文本都被视为 code body。


复现文本:

- ```js
  alert("123")
  ```
- 前word后

结果:

前word后 没有正确 padding。

在代码区似乎不会被格式化

例如下方代码块中的注释部分,使用插件的格式化后,中英文之间不会被添加空格,希望能够修复~

{
    var a = 1;
}

console.log(a); //这里的a,指的是区块里的a

非英文的拉丁字母识别错误,也会加空格

你好,

目前非英文的拉丁字母识别错误,也会加空格。

例如:

* Gonzalo Maeso, D., 1971, “La Judería de Soria y el Rabino José Albo”, *Misceláneade Estudios Arabes y Hebraicos*, 20 (2): 119–141.

会变成:

* Gonzalo Maeso, D., 1971, “La Juder í a de Soria y el Rabino Jos é Albo”, *Miscel á neade Estudios Arabes y Hebraicos*, 20 (2): 119–141.
* Tänzer, A., 1896, *Die Religionsphilosophie Josef Albo’s nach seinem werke ‘Ikkarim’: Systematisch Dragestellt und Erläutert*, Frankfurt a.M.: Kauffmann.

会变成:

* T ä nzer, A., 1896, *Die Religionsphilosophie Josef Albo’s nach seinem werke ‘Ikkarim’: Systematisch Dragestellt und Erl ä utert*, Frankfurt a.M.: Kauffmann.
# 萨克森的阿尔伯特 Albert of Saxony (Joél Biard)

会变成:

# 萨克森的阿尔伯特 Albert of Saxony (Jo é l Biard)

should be compatible with incorrect code syntax

开发者你好,发现一个 BUG。

对于以下文本,ABC 被三个反引号包裹,很多编辑器会将其解析为单个反引号的 code 语法。

```ABC```

前1后
前2后
前3后

但是由于源码中的以下代码,会将 ABC``` 解析为 lang,导致之后的所有内容都被解析为 codeBody,进而之后的全部文本都会失效

else if (state === state_1.State.BlockCodeLang && str[i] === '\n') {
    codeLang = popMarkdown();
    push(state_1.State.BlockCodeBody);
    i++;
}
else if (state === state_1.State.BlockCodeBody && c3 === blockCodeDelimiter) {
    resolve(new block_code_1.BlockCode(codeLang, blockCodeDelimiter, (0, parse_code_1.parseCode)(popMarkdown(), codeLang, parse, options)));
    i += 3;
}

以 `*` 开头的列表会对后边的 `*` 误识别

如:

* –––, 2016, “L’antico Egitto, I suoi monumenti e i suoi idoli nelle riflessioni di un intellettuale musulmano vissuto tra XII e XIII secolo”, in *Pensiero e formazione. Stidi in onore di Giuseppe Micheli*, G. Piaia and G. Zago (eds.), Padova: CLEUP, pp. 171–186.
* –––, 2017, “ “Vi racconterò delle meraviglie che ho veduto con i miei occhi”. Un intellettuale musulmano al tempo del Saladino racconta l’Egitto ” ”, in *Atti e memorie dell’accademia galileiana di scienze, lettere ed arti in Padova*, parte i. atti 129: 43–57.
* –––, 2017a, “God’s Will and the Origin of the World. ‘Abd al-Latif al-Baghdadi’s Sources and Arguments”, *The Muslim World*, 107: 482–495.
* –––, 2017b, “The first ‘Proclean’ section (Chapter 20) of ʻAbd al-Laṭīf al-Baġdādī’s *Book on the Science of Metaphysics*. Is the Pure Good of the Maḥḍ al-ḫayr Aristotle’s First Principle, Intellect in Actuality?”, *Oriens*, 45 (2017), pp. 259–305.
* –––, 2018, “Una parafrasi araba di Metafisica Iota. Il capitolo undicesimo dal Libro sulla scienza della Metafisica di ʻAbd al-Laṭīf al-Baġdādī”, *Studia graeco-arabica*, 8 (2018), pp. 269–286.
* Meyrav, Y., *Themistius’ paraphrase of Aristotle’s Metaphysics 12: a critical Hebrew-Arabic edition of the surviving textual evidence, with an introduction, preliminary studies, and a commentary*, Leiden: Brill.
* Rashed, M., 2004, “Priorité de l’ΕΙΔΟΣ ou du ΓΕΝΟΣ entre Andronicos et Alexandre: vestiges arabes et grecs inédits”, *Arabic Sciences and Philosophy*, 14: 9–63.
* Rosenthal, F., “From Arabic Book and Manuscripts V: A one-volume library of Arabic philosophical and scientific texts in Istanbul”, *Journal of the American Oriental Society* 75 (1955): 14–23.
* Shalem, A., 2015, “Experientia and Auctoritas: ‘Abd Al-Latif al-Bagjdadi’s Kitab Al-Ifada Wa-l-I‘tibar and the Birth of the Critical Gaze, *Muqarnas Online*, 32 (1): 197–212.
* Stern, S.M., 1962, “A Collection of Treatises by ‘Abd al-Latif al-Baghdadi”, *Islamic Studies*, 1(1): 53–70.
* Taylor, R.C., 1981, *The Liber de Causis (Kalam fi mahd al-khayr). A study of Medieval Neoplatonism*, PhD Thesis, Toronto.
* –––, 1982, “Neoplatonic Texts in Turkey: Two Manuscripts Containing Ibn Tufayl’s *Hayy Ibn Yaqzan*, Ibn al-Sid’s *Kitab al-Hada’iq*, Ibn Bajja’s *Ittisal al-‘aql bi-l-insan*, *the Liber de causis* and an Anonymous Neoplatonic *Treatise on Motion*”, *Mélanges de l’Institut Dominican d’Etudes Orientales*, 15: 251–264.
* Toorawa, S.M., 1996, “The educational background of ‘Abd al-Latif al-Baghdadi”, *Muslim Education Quarterly*, 13 (1996), pp. 35–53.
* –––, 1997, Language and male homosocial desire in the autobiography of ‘Abd al-Latif al-Baghdadi (d. 629/1231)”, *Edebiyat. The Journal of Middle Easter Literatures*, 7(1997), pp. 45–59.
* –––, 2001, “The Autobiography of ‘Abd al-Latif al-Baghdadi (1162–1231)”, in *Interpreting the Self. Autobiography in the Arabic Literary Tradition*, D.F. Reynolds (ed.), Berkeley Los Angeles London: University of California Press, pp. 156–164.
* –––, 2004, “A Portrait of ‘Abd al-Latif al-Baghdadi’s Education and Instruction”, in *Law and Education in Medieval Islam. Studies in memory of Professor G. Makdisi*, J.E. Lowry, D.J. Stewart, and S.M. Toorawa (eds.), Oxford: E.J.W. Gibb Memorial Trust Series, pp. 91–109.
* –––, 2004a, “Travel in medieval Islamic World: the Importance of Patronage as illustrated by ‘Abd al-Latif al-Baghdadi (d. 629/1231) (and others littérateurs)”, in *Eastward Bound. Travel and travellers 1050–1550*, R. Allen (ed.), Manchester New York: Manchester University Press, pp. 53–70.
* Van Ess, J., 1966, “Über einige neue Fragmente des Alexander von Aphrodisias und des Proklos in arabischer Übersetzung”, *Der Islam*, 42: 148–68.
* Von Somogyi, J., 1937, “Ein arabischer Bericht über die Tataren im *Ta’rikh al-Islam* von al-Dhahabi”, *Der Islam*, 24(2): 105–130.
* Wiedeman, E., 1907, “Zur Alchemie bei den Arabern”, *Separatabdruck aus dem Journal für praktische Chemie*, 76: 65–123.
* Zimmermann, F.W., 1986, “The Origins of the So-called Theology of Aristotle”, in *Pseudo- Aristotle in the Middle Ages. The Theology and other texts*, J. Kraye, W.F. Ryan, and C.B. Schmitt (eds), London: The Warburg Institute, pp. 110–240.
* –––, 1994, “Proclus Arabus Rides Again”, *Arabic Sciences and Philosophy*, 4: 9–51.

会被识别并处理为:

Piaia and G. Zago (eds.), Padova: CLEUP, pp. 171–186.
* –––, 2017, “ “Vi racconterò delle meraviglie che ho veduto con i miei occhi”. Un intellettuale musulmano al tempo del Saladino racconta l’Egitto ” ”, in * Atti e memorie dell’accademia galileiana di scienze, lettere ed arti in Padova*, parte i. atti 129: 43–57.
* –––, 2017a, “God’s Will and the Origin of the World. ‘Abd al-Latif al-Baghdadi’s Sources and Arguments”, * The Muslim World*, 107: 482–495.
* –––, 2017b, “The first ‘Proclean’ section (Chapter 20) of ʻAbd al-Laṭīf al-Baġdādī’s * Book on the Science of Metaphysics *. Is the Pure Good of the Maḥḍ al-ḫayr Aristotle’s First Principle, Intellect in Actuality?”, * Oriens*, 45 (2017), pp. 259–305.
* –––, 2018, “Una parafrasi araba di Metafisica Iota. Il capitolo undicesimo dal Libro sulla scienza della Metafisica di ʻAbd al-Laṭīf al-Baġdādī”, * Studia graeco-arabica*, 8 (2018), pp. 269–286.
* Meyrav, Y., * Themistius’ paraphrase of Aristotle’s Metaphysics 12: a critical Hebrew-Arabic edition of the surviving textual evidence, with an introduction, preliminary studies, and a commentary*, Leiden: Brill.
* Rashed, M., 2004, “Priorité de l’ΕΙΔΟΣ ou du ΓΕΝΟΣ entre Andronicos et Alexandre: vestiges arabes et grecs inédits”, * Arabic Sciences and Philosophy*, 14: 9–63.
* Rosenthal, F., “From Arabic Book and Manuscripts V: A one-volume library of Arabic philosophical and scientific texts in Istanbul”, * Journal of the American Oriental Society* 75 (1955): 14–23.
* Shalem, A., 2015, “Experientia and Auctoritas: ‘Abd Al-Latif al-Bagjdadi’s Kitab Al-Ifada Wa-l-I‘tibar and the Birth of the Critical Gaze, * Muqarnas Online*, 32 (1): 197–212.
* Stern, S.M., 1962, “A Collection of Treatises by ‘Abd al-Latif al-Baghdadi”, * Islamic Studies*, 1(1): 53–70.
* Taylor, R.C., 1981, * The Liber de Causis (Kalam fi mahd al-khayr). A study of Medieval Neoplatonism*, PhD Thesis, Toronto.
* –––, 1982, “Neoplatonic Texts in Turkey: Two Manuscripts Containing Ibn Tufayl’s * Hayy Ibn Yaqzan *, Ibn al-Sid’s * Kitab al-Hada’iq *, Ibn Bajja’s * Ittisal al-‘aql bi-l-insan *, * the Liber de causis * and an Anonymous Neoplatonic * Treatise on Motion *”, * Mélanges de l’Institut Dominican d’Etudes Orientales*, 15: 251–264.
* Toorawa, S.M., 1996, “The educational background of ‘Abd al-Latif al-Baghdadi”, * Muslim Education Quarterly*, 13 (1996), pp. 35–53.
* –––, 1997, Language and male homosocial desire in the autobiography of ‘Abd al-Latif al-Baghdadi (d. 629/1231)”, * Edebiyat. The Journal of Middle Easter Literatures*, 7(1997), pp. 45–59.
* –––, 2001, “The Autobiography of ‘Abd al-Latif al-Baghdadi (1162–1231)”, in * Interpreting the Self. Autobiography in the Arabic Literary Tradition*, D.F. Reynolds (ed.), Berkeley Los Angeles London: University of California Press, pp. 156–164.
* –––, 2004, “A Portrait of ‘Abd al-Latif al-Baghdadi’s Education and Instruction”, in * Law and Education in Medieval Islam. Studies in memory of Professor G. Makdisi*, J.E. Lowry, D.J. Stewart, and S.M. Toorawa (eds.), Oxford: E.J.W. Gibb Memorial Trust Series, pp. 91–109.
* –––, 2004a, “Travel in medieval Islamic World: the Importance of Patronage as illustrated by ‘Abd al-Latif al-Baghdadi (d. 629/1231) (and others littérateurs)”, in * Eastward Bound. Travel and travellers 1050–1550*, R. Allen (ed.), Manchester New York: Manchester University Press, pp. 53–70.
* Van Ess, J., 1966, “Über einige neue Fragmente des Alexander von Aphrodisias und des Proklos in arabischer Übersetzung”, * Der Islam*, 42: 148–68.
* Von Somogyi, J., 1937, “Ein arabischer Bericht über die Tataren im * Ta’rikh al-Islam * von al-Dhahabi”, * Der Islam*, 24(2): 105–130.
* Wiedeman, E., 1907, “Zur Alchemie bei den Arabern”, * Separatabdruck aus dem Journal für praktische Chemie*, 76: 65–123.
* Zimmermann, F.W., 1986, “The Origins of the So-called Theology of Aristotle”, in * Pseudo- Aristotle in the Middle Ages. The Theology and other texts*, J. Kraye, W.F. Ryan, and C.B. Schmitt (eds), London: The Warburg Institute, pp. 110–240.
* –––, 1994, “Proclus Arabus Rides Again”, * Arabic Sciences and Philosophy*, 4: 9–51.

如图,以 * 开头的列表会对后边的 * 误识别:

NZ2 X{ZB R__EE~K08(AOSD

对picture resize 的错误格式化

你好,最近使用了阁下的vscode版的格式化插件,大多场合下都能顺利工作,但是当在picture后引入resize参数后,格式化将导致resize 失效,如:
原来(resize起作用):
![ ](test.png){width=8cm}
格式化后 (resize不起作用)
![ ](test.png){width = 8 cm}

这样就无法实现对图片的resize了,请问能修复吗?
感觉可以对{}[]这类符号中的英文取消格式操作,避免类似的误操作。

对英文冒号设置 `--ignore-words` 参数不生效

我的用法:

find "$(pwd)" -type f -name "*.md" | npx md-padding@latest --ignore-words '-' ':' -f --read-files -i

仍然会处理英文冒号。似乎只会处理第一个参数。

以及对 1:2::2:1类似格式仍然会在第三个冒号后边插入空格。

例如:

英语冒号问题:

https://github.com/taophilosophy/SEP-CN/blob/main/a/a-er-kai-xi-lao-arcesilaus-charles-brittain-and-peter-osorio.md

比例问题:

https://github.com/taophilosophy/SEP-CN/blob/main/a/a-er-ku-ta-si-archytas-carl-huffman.md

有什么方法能支持识别 `<br />` 等特殊 htmlTag?

以下文本:

|      |                       |
| ---- | --------------------- |
|      | 123<br />456<br />789 |

渲染如下:

123
456
789

可见,虽然 123<br />456<br />789 处于同一行,但是用户期望的是换行输出,因此 <br /> 之后不能添加空格。

也就是说,需要识别 htmlTag 的内容,进行特殊处理。

需要解析代码中的字符串

以下示例会被错误格式化:

```javascript
let s = 'https://google.com?q=天气'
```

```javascript
let s = 'https://github.com?q = 天气 '
```

部分语言支持反引号(`)字符串

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.


No npm token specified.

An npm token must be created and set in the NPM_TOKEN environment variable on your CI environment.

Please make sure to create an npm token and to set it in the NPM_TOKEN environment variable on your CI environment. The token must allow to publish to the registry https://registry.npmjs.org/.


Good luck with your project ✨

Your semantic-release bot 📦🚀

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.