mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
* Don't replace leading digit * Install css.escape * Escape leading digit of the anchor id
This commit is contained in:
parent
2928eb7e55
commit
90a35ab952
6
package-lock.json
generated
6
package-lock.json
generated
@ -3263,6 +3263,12 @@
|
||||
"integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==",
|
||||
"dev": true
|
||||
},
|
||||
"css.escape": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz",
|
||||
"integrity": "sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s=",
|
||||
"dev": true
|
||||
},
|
||||
"cssesc": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cssesc/-/cssesc-2.0.0.tgz",
|
||||
|
||||
@ -74,6 +74,7 @@
|
||||
"conventional-changelog-cli": "^2.0.25",
|
||||
"copy-dir": "^1.2.0",
|
||||
"cross-env": "^6.0.3",
|
||||
"css.escape": "^1.5.1",
|
||||
"cssnano": "^4.1.10",
|
||||
"cypress": "^3.8.1",
|
||||
"cypress-image-snapshot": "^3.1.1",
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { isMobile } from '../util/env'
|
||||
import * as dom from '../util/dom'
|
||||
import Tweezer from 'tweezer.js'
|
||||
import cssEscape from 'css.escape'
|
||||
|
||||
const nav = {}
|
||||
let hoverOver = false
|
||||
@ -138,7 +139,7 @@ export function scrollIntoView(path, id) {
|
||||
return
|
||||
}
|
||||
|
||||
const section = dom.find('#' + id)
|
||||
const section = dom.find('#' + cssEscape(id))
|
||||
section && scrollTo(section)
|
||||
|
||||
const li = nav[getNavKey(path, id)]
|
||||
|
||||
@ -19,7 +19,6 @@ export function slugify(str) {
|
||||
.replace(re, '')
|
||||
.replace(/\s/g, '-')
|
||||
.replace(/-+/g, '-')
|
||||
.replace(/^(\d)/, '_$1')
|
||||
let count = cache[slug]
|
||||
|
||||
count = hasOwn.call(cache, slug) ? count + 1 : 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user