Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
c1227b2
fix: packages/docsify-server-renderer/package.json & packages/docsify…
snyk-bot Jan 13, 2022
719dcbe
fix: correctly fix missing +1, -1 (#1722)
ChoKaPeek Jan 14, 2022
799c0a4
Update LICENSE
trusktr Jan 17, 2022
e0bead3
Merge pull request #1725 from docsifyjs/update-license
trusktr Jan 23, 2022
47cb36e
mention that SSR is experimental and incomplete, prevent people from …
trusktr Jan 24, 2022
b58941e
Merge pull request #1734 from docsifyjs/mark-ssr-as-experimental
trusktr Jan 26, 2022
c49c39a
refactor: Update test environments and lint configuration (#1736)
jhildenbiddle Jan 31, 2022
f5b5282
chore: bump node-fetch in /packages/docsify-server-renderer (#1738)
dependabot[bot] Feb 1, 2022
18cd18c
docs: update readme (#1740)
sy-records Feb 2, 2022
301b516
fix: Coverpage when content > viewport height (#1744)
jhildenbiddle Feb 3, 2022
8aee074
chore: sync emojis (#1745)
sy-records Feb 4, 2022
fa6df6d
fix: Legacy bugs (styles, site plugin error, and dev server error) (#…
jhildenbiddle Feb 5, 2022
2dc5b12
fix: package.json & package-lock.json to reduce vulnerabilities (#1756)
snyk-bot Feb 24, 2022
a00cfbb
chore: bump follow-redirects from 1.14.7 to 1.14.9 (#1757)
dependabot[bot] Feb 25, 2022
fd883e6
chore: bump prismjs in /packages/docsify-server-renderer (#1760)
dependabot[bot] Mar 3, 2022
35002c9
feat: Native emoji w/ image-based fallbacks and improved parsing (#1746)
jhildenbiddle Mar 6, 2022
ba5ee26
feat: Emoji build (#1766)
jhildenbiddle Mar 8, 2022
9bff31d
chore: Remove dompurify (#1490)
jhildenbiddle Mar 8, 2022
716a48e
chore: update develop branch preview link (#1772)
sy-records Mar 15, 2022
63b2535
feat: Plugin error handling (#1742)
jhildenbiddle Mar 15, 2022
32c6b38
Fix: ready/doneEach order with async afterEach (#1770)
jhildenbiddle Mar 16, 2022
6f4f09b
docs: Update configuration options (#1773)
jhildenbiddle Mar 18, 2022
9e6a3e6
docs: Minor fixes to plugin docs (#1774)
jhildenbiddle Mar 19, 2022
093d4a0
chore: update vercel link (#1775)
sy-records Mar 19, 2022
2d13255
chore: update vercel logo (#1776)
sy-records Mar 23, 2022
bec187f
chore: Update CONTRIBUTING.md (#1782)
bhbarquero-dev Mar 31, 2022
b8b221f
chore: bump minimist from 1.2.5 to 1.2.6 (#1787)
dependabot[bot] Apr 13, 2022
8cbc7c8
Virtual Routes Support (#1799)
illBeRoy May 23, 2022
fa14210
docs: update the name for "Simplified Chinese" (#1811)
awxiaoxian2020 Jun 3, 2022
54cc5f9
fix: cornerExternalLinkTarget config. (#1814)
Koooooo-7 Jun 4, 2022
150236a
Improve README.md sentence (#1817)
shaunbharat Jun 7, 2022
1e46f2b
chore: bump jpeg-js from 0.4.3 to 0.4.4 (#1820)
dependabot[bot] Jun 17, 2022
682bf96
chore: bump parse-url from 6.0.0 to 6.0.2 (#1833)
dependabot[bot] Jul 10, 2022
19e40c2
Docs: Fix plugin insertion order in docs (#1850)
jhildenbiddle Aug 2, 2022
3c9b3d9
fix: Ignore emoji shorthand codes in URIs (#1847)
socsieng Aug 3, 2022
9832805
fix: fix docsify-ignore in seach title. (#1872)
Koooooo-7 Aug 30, 2022
9b74744
fix: fix search with no content. (#1878)
Koooooo-7 Sep 17, 2022
c98fda7
docs: Update GitHub default branch from to 'main' (#1883)
123MwanjeMike Sep 17, 2022
79a6619
chore: upgrade caniuse-lit. (#1879)
Koooooo-7 Sep 20, 2022
91272ca
chore: bump trim-newlines and lerna (#1895)
dependabot[bot] Oct 4, 2022
d27af3d
fix: filter null node first. (#1909)
Koooooo-7 Oct 26, 2022
7db2434
[build]: 4.12.3
Koooooo-7 Oct 26, 2022
8fcd92b
[build] 4.12.4
Koooooo-7 Oct 26, 2022
c044517
chore: add changelog 4.12.4
Koooooo-7 Oct 26, 2022
6ac6f52
update: update dependencies.
Koooooo-7 Oct 26, 2022
73ea28d
fix: fix test.
Koooooo-7 Oct 26, 2022
dbc4b45
fix: upgrade dependencies.
Koooooo-7 Oct 26, 2022
a6701d6
[build] 4.13.0
Koooooo-7 Oct 26, 2022
1d29eb3
chore: add changelog 4.13.0
Koooooo-7 Oct 26, 2022
78aaa37
chore: add changelog v4.13.0
Koooooo-7 Oct 26, 2022
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: Native emoji w/ image-based fallbacks and improved parsing (#1746)
* Render native emoji with image fallback Fix #779 * Deprecate emoji plugin * Add emoji tests * Remove console.log statement * Fix emoji image alt attribute * Set nativeEmoji to false by default (non-breaking) * Fix parsing emoji in HTML comments and script tags * Add nativeEmoji and update noEmoji details * Add Emoji plugin deprecation notice * Fix ESLint issues * Create build:emoji task - Auto-generate emoji data from GitHub API - Auto-generate emoji markdown for website - Add emoji page to navigation * Fix rendering of GitHub emoji without unicode * Adjust and match size of native and image emoji * Update emoji test snapshot * Update docs test snapshot * Fix ci/codesandbox error * Update native emoji font-stack * Fix rendering of native multi-character emoji * Kick GitHub Workflow * Replace rollup’s uglify plugin with terser * Switch “npm ci” instead of “npm i” for stability * Change emoji data from default to named export * Revert "Replace rollup’s uglify plugin with terser" This reverts commit 7ba8513. * Revert "Switch “npm ci” instead of “npm i” for stability" This reverts commit d52b476. * Revert "Change emoji data from default to named export" This reverts commit 3f2dd46. * Specify codesandbox template and node version * Update codesandbox config * Revert "Revert "Replace rollup’s uglify plugin with terser"" This reverts commit e06fed4. * Revert "Revert "Revert "Replace rollup’s uglify plugin with terser""" This reverts commit 27d4952. * Update codesandbox config * Revert "Update codesandbox config" This reverts commit 5120dd2. * Fix codesandbox uglify error * Emoji docs tweaks * Restore and update emoji plugin code * Restore and update emoji plugin docs * Prettier updates * Match lowercase shortcodes only Co-authored-by: Koy Zhuang <369491420@qq.com>
  • Loading branch information
jhildenbiddle and Koooooo-7 authored Mar 6, 2022
commit 35002c92b762f0d12e51582d7de7914fa380596a
3 changes: 2 additions & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"sandboxes": ["2d17z"],
"packages": [".", "packages/docsify-server-renderer"]
"packages": [".", "packages/docsify-server-renderer"],
"node": "16"
}
91 changes: 91 additions & 0 deletions build/emoji.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
const axios = require('axios');
const fs = require('fs');
const path = require('path');

const filePaths = {
emojiMarkdown: path.resolve(process.cwd(), 'docs', 'emoji.md'),
emojiJS: path.resolve(
process.cwd(),
'src',
'core',
'render',
'emojify-data.js'
),
};

async function getEmojiData() {
const emojiDataURL = 'https://api.github.com/emojis';
const response = await axios.get(emojiDataURL);
const baseURL = Object.values(response.data)
.find(url => /unicode\//)
.split('unicode/')[0];
const data = { ...response.data };

// Remove base URL from emoji URLs
Object.entries(data).forEach(
([key, value]) => (data[key] = value.replace(baseURL, ''))
);

return {
baseURL,
data,
};
}

function writeEmojiPage(emojiData) {
const emojiPage =
(fs.existsSync(filePaths.emojiMarkdown) &&
fs.readFileSync(filePaths.emojiMarkdown, 'utf8')) ||
`<!-- START -->\n\n<!-- END -->`;
const emojiRegEx = /(<!--\s*START.*-->\n)([\s\S]*)(\n<!--\s*END.*-->)/;
const emojiMatch = emojiPage.match(emojiRegEx);
const emojiMarkdownStart = emojiMatch[1].trim();
const emojiMarkdown = emojiMatch[2].trim();
const emojiMarkdownEnd = emojiMatch[3].trim();
const newEmojiMarkdown = Object.keys(emojiData.data)
.reduce(
(preVal, curVal) =>
(preVal += `:${curVal}: ` + '`' + `:${curVal}:` + '`' + '\n\n'),
''
)
.trim();

if (emojiMarkdown !== newEmojiMarkdown) {
const newEmojiPage = emojiPage.replace(
emojiMatch[0],
`${emojiMarkdownStart}\n${newEmojiMarkdown}\n${emojiMarkdownEnd}`
);

fs.writeFileSync(filePaths.emojiMarkdown, newEmojiPage);
console.info(`- Created new file: ${filePaths.emojiMarkdown}`);
} else {
console.info(`- No changes to file: ${filePaths.emojiMarkdown}`);
}
}

function writeEmojiJS(emojiData) {
const emojiJS =
fs.existsSync(filePaths.emojiJS) &&
fs.readFileSync(filePaths.emojiJS, 'utf8');
const newEmojiJS = `export default ${JSON.stringify(emojiData, {}, 2)}`;

if (!emojiJS || emojiJS !== newEmojiJS) {
fs.writeFileSync(filePaths.emojiJS, newEmojiJS);
console.info(`- Created new file: ${filePaths.emojiJS}`);
} else {
console.info(`- No changes to file: ${filePaths.emojiJS}`);
}
}

(async () => {
console.log('Build emoji');

try {
const emojiData = await getEmojiData();

writeEmojiPage(emojiData);
writeEmojiJS(emojiData);
} catch (e) {
console.error(e);
}
})();
1 change: 1 addition & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [Write a Plugin](write-a-plugin.md)
- [Markdown configuration](markdown.md)
- [Language highlighting](language-highlight.md)
- [Emoji](emoji.md)

- Guide

Expand Down
90 changes: 84 additions & 6 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The config can also be defined as a function, in which case the first argument i

```html
<script>
window.$docsify = function(vm) {
window.$docsify = function (vm) {
return {
markdown: {
renderer: {
Expand Down Expand Up @@ -319,14 +319,14 @@ window.$docsify = {
markdown: {
smartypants: true,
renderer: {
link: function() {
link: function () {
// ...
},
},
},

// function
markdown: function(marked, renderer) {
markdown: function (marked, renderer) {
// ...
return marked;
},
Expand Down Expand Up @@ -398,19 +398,97 @@ 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.md?id=external-script) plugin.

## nativeEmoji

- type: `Boolean`
- default: `false`

Render emoji shorthand codes using GitHub-style emoji images or platform-native emoji characters.

```js
window.$docsify = {
nativeEmoji: true,
};
```

```markdown
:smile:
:partying_face:
:joy:
:+1:
:-1:
```

GitHub-style images when `false`:

<output data-lang="output">
<img class="emoji" src="https://github.githubassets.com/images/icons/emoji/unicode/1f604.png" alt="smile">
<img class="emoji" src="https://github.githubassets.com/images/icons/emoji/unicode/1f973.png" alt="partying_face">
<img class="emoji" src="https://github.githubassets.com/images/icons/emoji/unicode/1f602.png" alt="joy">
<img class="emoji" src="https://github.githubassets.com/images/icons/emoji/unicode/1f44d.png" alt="+1">
<img class="emoji" src="https://github.githubassets.com/images/icons/emoji/unicode/1f44e.png" alt="-1">
</output>

Platform-native characters when `true`:

<output data-lang="output">
<span class="emoji">😄︎</span>
<span class="emoji">🥳︎</span>
<span class="emoji">😂︎</span>
<span class="emoji">👍︎</span>
<span class="emoji">👎︎</span>
</output>

To render shorthand codes as text, replace `:` characters with the `&colon;` HTML entity.

```markdown
&colon;100&colon;
```

<output data-lang="output">

&colon;100&colon;

</output>

## noEmoji

- type: `Boolean`
- default: `false`

Disabled emoji parse.
Disabled emoji parsing and render all emoji shorthand as text.

```js
window.$docsify = {
noEmoji: true,
};
```

?> If this option is `false` but you don't want to emojify some specific colons, [refer to this](https://github.com/docsifyjs/docsify/issues/742#issuecomment-586313143)
```markdown
:100:
```

<output data-lang="output">

&colon;100&colon;

</output>

To disable emoji parsing of individual shorthand codes, replace `:` characters with the `&colon;` HTML entity.

```markdown
:100:

&colon;100&colon;
```

<output data-lang="output">

:100:

&colon;100&colon;

</output>

## mergeNavbar

Expand All @@ -435,7 +513,7 @@ See https://github.com/lukeed/tinydate#patterns
window.$docsify = {
formatUpdated: '{MM}/{DD} {HH}:{mm}',

formatUpdated: function(time) {
formatUpdated: function (time) {
// ...

return time;
Expand Down
Loading