Skip to content

Commit 3aef37a

Browse files
committed
feat(emojify): add no-emoji option
1 parent 37daa7e commit 3aef37a

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

docs/configuration.md

+10
Original file line numberDiff line numberDiff line change
@@ -295,3 +295,13 @@ window.$docsify = {
295295
```
296296

297297
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.
298+
299+
## no-emoji
300+
301+
Disabled emoji parse.
302+
303+
```js
304+
window.$docsify = {
305+
noEmoji: true
306+
}
307+
```

docs/zh-cn/configuration.md

+10
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,13 @@ window.$docsify = {
305305
```
306306

307307
注意如果执行的是一个外链脚本,比如 jsfiddle 的内嵌 demo,请确保引入 [external-script](zh-cn/plugins?id=外链脚本-external-script) 插件。
308+
309+
## no-emoji
310+
311+
禁用 emoji 解析。
312+
313+
```js
314+
window.$docsify = {
315+
noEmoji: true
316+
}
317+
```

src/core/config.js

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const config = merge({
1616
nameLink: window.location.pathname,
1717
autoHeader: false,
1818
executeScript: null,
19+
noEmoji: false,
1920
ga: ''
2021
}, window.$docsify)
2122

src/core/render/emojify.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function replace (m, $1) {
33
}
44

55
export function emojify (text) {
6-
return text
6+
return $docsify.noEmoji ? text : text
77
.replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g, m => m.replace(/:/g, '__colon__'))
88
.replace(/:(\w+?):/ig, window.emojify || replace)
99
.replace(/__colon__/g, ':')

0 commit comments

Comments
 (0)