feat(emojify): add no-emoji option
This commit is contained in:
parent
37daa7ef9c
commit
3aef37a445
4 changed files with 22 additions and 1 deletions
|
|
@ -295,3 +295,13 @@ window.$docsify = {
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that if you are running an external script, e.g. an embedded jsfiddle demo, make sure to include the [external-script](plugins?id=external-script) plugin.
|
Note that if you are running an external script, e.g. an embedded jsfiddle demo, make sure to include the [external-script](plugins?id=external-script) plugin.
|
||||||
|
|
||||||
|
## no-emoji
|
||||||
|
|
||||||
|
Disabled emoji parse.
|
||||||
|
|
||||||
|
```js
|
||||||
|
window.$docsify = {
|
||||||
|
noEmoji: true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
|
||||||
|
|
@ -305,3 +305,13 @@ window.$docsify = {
|
||||||
```
|
```
|
||||||
|
|
||||||
注意如果执行的是一个外链脚本,比如 jsfiddle 的内嵌 demo,请确保引入 [external-script](zh-cn/plugins?id=外链脚本-external-script) 插件。
|
注意如果执行的是一个外链脚本,比如 jsfiddle 的内嵌 demo,请确保引入 [external-script](zh-cn/plugins?id=外链脚本-external-script) 插件。
|
||||||
|
|
||||||
|
## no-emoji
|
||||||
|
|
||||||
|
禁用 emoji 解析。
|
||||||
|
|
||||||
|
```js
|
||||||
|
window.$docsify = {
|
||||||
|
noEmoji: true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ const config = merge({
|
||||||
nameLink: window.location.pathname,
|
nameLink: window.location.pathname,
|
||||||
autoHeader: false,
|
autoHeader: false,
|
||||||
executeScript: null,
|
executeScript: null,
|
||||||
|
noEmoji: false,
|
||||||
ga: ''
|
ga: ''
|
||||||
}, window.$docsify)
|
}, window.$docsify)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ function replace (m, $1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function emojify (text) {
|
export function emojify (text) {
|
||||||
return text
|
return $docsify.noEmoji ? text : text
|
||||||
.replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g, m => m.replace(/:/g, '__colon__'))
|
.replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g, m => m.replace(/:/g, '__colon__'))
|
||||||
.replace(/:(\w+?):/ig, window.emojify || replace)
|
.replace(/:(\w+?):/ig, window.emojify || replace)
|
||||||
.replace(/__colon__/g, ':')
|
.replace(/__colon__/g, ':')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue