Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unescaped \ escaping char in sidebar titles #155

Closed
patak-dev opened this issue Nov 25, 2020 · 3 comments · Fixed by #172
Closed

unescaped \ escaping char in sidebar titles #155

patak-dev opened this issue Nov 25, 2020 · 3 comments · Fixed by #172
Labels
bug Something isn't working

Comments

@patak-dev
Copy link
Member

From #152 (comment)

The issue appears when using the escaping char in heading in markdown, for example:

## \$page

image

@patak-dev patak-dev added the bug: pending triage Maybe a bug, waiting for confirmation label Nov 25, 2020
@kiaking kiaking added bug Something isn't working and removed bug: pending triage Maybe a bug, waiting for confirmation labels Nov 26, 2020
@kiaking
Copy link
Member

kiaking commented Nov 26, 2020

When escaping, the string seems to get double escape. See \\$page. Not sure where to look at, at the moment.

Screen Shot 2020-11-26 at 17 43 00

@patak-dev
Copy link
Member Author

patak-dev commented Dec 1, 2020

I was reviewing unmerged PRs from vuepress and found two that are related to this issue:

This one is a direct fix: vuejs/vuepress#2363
Also including support for superscript and subscript

## \$accentColor
## Infomation about H~2~O
## $\S$ 1.1

This one fixed other cases vuejs/vuepress#2688 (and if I think it also includes a fix for this issue)

## [Subscript](https://github.com/markdown-it/markdown-it-sub) / [Superscript](https://github.com/markdown-it/markdown-it-sup)
## [\<ins>](https://github.com/markdown-it/markdown-it-ins)
## [\<mark>](https://github.com/markdown-it/markdown-it-mark)

I think all of the above examples are failing in vitepress too.

Should we port the tests from
https://github.com/vuejs/vuepress/blob/master/packages/@vuepress/shared-utils/__tests__/parseHeaders.spec.ts
into vitepress tests like:
/__tests__/node/utils/parseHeader.spec.ts
and port the fixes of these PRs?

For later, If both vitepress and vuepress will coexist, maybe there could be a package at one point to share these utils so both projects will benefit from the fixes.

@patak-dev
Copy link
Member Author

I started working on this one to better understand the issue. There are two tests more that we should port:
https://github.com/vuejs/vuepress/blob/master/packages/@vuepress/shared-utils/__tests__/deeplyParseHeaders.spec.ts
https://github.com/vuejs/vuepress/blob/master/packages/@vuepress/shared-utils/__tests__/removeNonCodeWrappedHTML.spec.ts

The changes in the PRs are working as expected.

The only part I am not sure if should be added is this one from vuejs/vuepress#2363:

Also some people will use katex or mathjax, superscript and subscript to display math or chemistry expression in their headings. Though vuepress is not providing these plugins by default, it's better that vuepress can handle them

## $\S$ 1.1                   // mathjax symbol

## Infomation about H~2~O     // subscript, but it means strikethrough in github comments

I am inclined to also include it, but maybe this should be handled by markdown plugins.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants