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

Header Anchors #121

Closed
xwvon opened this issue Apr 18, 2018 · 7 comments
Closed

Header Anchors #121

xwvon opened this issue Apr 18, 2018 · 7 comments

Comments

@xwvon
Copy link

xwvon commented Apr 18, 2018

The title can't begein with a Number.

@ulivz
Copy link
Member

ulivz commented Apr 18, 2018

Thanks for reporting for that. and would you please provide the detailed steps to repro? while I cannot repro for that. BTW, node version and system info should be given here.

@xwvon
Copy link
Author

xwvon commented Apr 18, 2018

When I give a title begin with number in my document, i cannot jump to that through the search input of navbar.

@xwvon
Copy link
Author

xwvon commented Apr 18, 2018

  1. I setting ##1Title in my markdown document.

  2. I search 1 in the search input of default theme.

  3. It will show an error in my chrome developer tools:

DOMException: Failed to execute 'querySelector' on 'Document': '#1greatest-common-divsior-Title' is not a valid selector.
    at scrollToPosition (webpack-internal:///../../../AppData/Roaming/npm/node_modules/vuepress/node_modules/vue-router/dist/vue-router.esm.js:1636:23)
    at Vue.eval (webpack-internal:///../../../AppData/Roaming/npm/node_modules/vuepress/node_modules/vue-router/dist/vue-router.esm.js:1579:7)
    at Array.eval (webpack-internal:///../../../AppData/Roaming/npm/node_modules/vuepress/node_modules/vue/dist/vue.runtime.esm.js:1832:12)
    at MessagePort.flushCallbacks (webpack-internal:///../../../AppData/Roaming/npm/node_modules/vuepress/node_modules/vue/dist/vue.runtime.esm.js:1753:14)

os window 10 Enterprise edition 1709
node version 8.9.0

@mdaffin
Copy link
Contributor

mdaffin commented Apr 18, 2018

##1Title is not valid markdown (some markdown parses handle it but it looks like the one vuepress uses does not) you should have a space after the last #: ## 1Title

@xwvon
Copy link
Author

xwvon commented Apr 18, 2018

I tried, but it not work.

@yyx990803
Copy link
Member

This can be improved in vue-router. But I've implemented a workaround here for now.

@xlsufo
Copy link

xlsufo commented May 21, 2019

First,you can go to https://github.com/vuejs/vuepress/tree/master/packages/@vuepress/shared-utils/src/slugify.ts to see the config.
And you can modify the file named slugify.js,its path in my computer is D:\my_program\nodejs\node_global\node_modules\vuepress\node_modules\@vuepress\shared-utils\lib\slugify.js, find your own path, and modify it ,you can slove your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants