Fix slugify
This commit is contained in:
parent
9ce47c48af
commit
424a243c5c
3 changed files with 11 additions and 15 deletions
20
README.md
20
README.md
|
|
@ -74,24 +74,14 @@ npm i && npm run dev
|
|||
open http://localhost:3000
|
||||
```
|
||||
|
||||
### MoreLanguageHighlight
|
||||
### More Language Highlight
|
||||
|
||||
By default,docsify will only highlight faw language ,such as `html`,`css`,`javascript` eg.
|
||||
if u want to add more ,like php. just edit `src/render.js` ,and then add a language import.
|
||||
|
||||
```javacript
|
||||
import marked from 'marked'
|
||||
import Prism from 'prismjs'
|
||||
//this line ↓
|
||||
import prism_php from 'prismjs/components/prism-php'
|
||||
// or
|
||||
import prism_ruby from 'prismjs/components/prism-ruby'
|
||||
// and so on...
|
||||
import prism_markdown from 'prismjs/components/prism-markdown'
|
||||
import * as tpl from './tpl'
|
||||
```html
|
||||
<script src="//unpkg.com/docsify"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-bash.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-php.js"></script>
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
MIT
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ const CACHE = {}
|
|||
const renderTo = function (dom, content) {
|
||||
dom = typeof dom === 'object' ? dom : document.querySelector(dom)
|
||||
dom.innerHTML = content
|
||||
slugify.clear()
|
||||
|
||||
return dom
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ export function slugify (string) {
|
|||
const re = /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,.\/:;<=>?@\[\]^`{|}~]/g
|
||||
const maintainCase = false
|
||||
const replacement = '-'
|
||||
|
||||
slugify.occurrences = slugify.occurrences || {}
|
||||
|
||||
if (typeof string !== 'string') return ''
|
||||
|
|
@ -134,3 +135,7 @@ export function slugify (string) {
|
|||
|
||||
return slug
|
||||
}
|
||||
|
||||
slugify.clear = function () {
|
||||
slugify.occurrences = {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue