mirror of
https://github.com/wahyd4/docsify.git
synced 2026-08-15 08:16:14 +10:00
* chore: added new linter config * chore: linting fixes * chore: refactore in linting config and minor linting fixes
21 lines
492 B
JavaScript
21 lines
492 B
JavaScript
import { inBrowser } from '../util/env';
|
|
|
|
function replace(m, $1) {
|
|
return (
|
|
'<img class="emoji" src="https://github.githubassets.com/images/icons/emoji/' +
|
|
$1 +
|
|
'.png" alt="' +
|
|
$1 +
|
|
'" />'
|
|
);
|
|
}
|
|
|
|
export function emojify(text) {
|
|
return text
|
|
.replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g, m =>
|
|
m.replace(/:/g, '__colon__')
|
|
)
|
|
.replace(/:(\w+?):/gi, (inBrowser && window.emojify) || replace)
|
|
.replace(/__colon__/g, ':');
|
|
}
|