mirror of
https://github.com/docsifyjs/docsify.git
synced 2026-10-17 04:31:18 +08:00
Change emoji data from default to named export
This commit is contained in:
+5
-1
@@ -67,7 +67,11 @@ function writeEmojiJS(emojiData) {
|
||||
const emojiJS =
|
||||
fs.existsSync(filePaths.emojiJS) &&
|
||||
fs.readFileSync(filePaths.emojiJS, 'utf8');
|
||||
const newEmojiJS = `export default ${JSON.stringify(emojiData, {}, 2)}`;
|
||||
const newEmojiJS = `export const emojifyData = ${JSON.stringify(
|
||||
emojiData,
|
||||
{},
|
||||
2
|
||||
)}`;
|
||||
|
||||
if (!emojiJS || emojiJS !== newEmojiJS) {
|
||||
fs.writeFileSync(filePaths.emojiJS, newEmojiJS);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default {
|
||||
export const emojifyData = {
|
||||
baseURL: 'https://github.githubassets.com/images/icons/emoji/',
|
||||
data: {
|
||||
100: 'unicode/1f4af.png?v8',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import emojiData from './emojify-data.js';
|
||||
import { emojifyData } from './emojify-data.js';
|
||||
|
||||
function replaceEmojiShorthand(m, $1, useNativeEmoji) {
|
||||
const emojiMatch = emojiData.data[$1];
|
||||
const emojiMatch = emojifyData.data[$1];
|
||||
|
||||
let result = m;
|
||||
|
||||
@@ -18,7 +18,7 @@ function replaceEmojiShorthand(m, $1, useNativeEmoji) {
|
||||
.concat('︎');
|
||||
result = `<span class="emoji">${emojiUnicode}</span>`;
|
||||
} else {
|
||||
result = `<img src="${emojiData.baseURL}${emojiMatch}.png" alt="${$1}" class="emoji" loading="lazy">`;
|
||||
result = `<img src="${emojifyData.baseURL}${emojiMatch}.png" alt="${$1}" class="emoji" loading="lazy">`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user