Skip to content

fix: Ignore emoji shorthand codes in URIs #1847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

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
test: Add test for emoji in anchor body
  • Loading branch information
socsieng committed Jul 30, 2022
commit feca1cd78f1c105a255bd93d5012b8b641b4061c
2 changes: 2 additions & 0 deletions test/integration/__snapshots__/emoji.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ exports[`Emoji Ignores all emoji shorthand codes (noEmoji:true) 1`] = `"<p>:smil

exports[`Emoji Ignores emoji shorthand codes in URIs 1`] = `"<p>Url <a href=\\"https://docsify.js.org/:foo:/\\" target=\\"_blank\\" rel=\\"noopener\\">https://docsify.js.org/:foo:/</a> <a href=\\"http://docsify.js.org/:100:/\\" target=\\"_blank\\" rel=\\"noopener\\">http://docsify.js.org/:100:/</a> <a href=\\"ftp://docsify.js.org/:smile:/\\" target=\\"_blank\\" rel=\\"noopener\\">ftp://docsify.js.org/:smile:/</a></p>"`;

exports[`Emoji Ignores emoji shorthand codes in URIs while handling anchor content 1`] = `"<p>Achor tags <a href=\\"http://docsify.js.org/:100:/\\" target=\\"_blank\\" rel=\\"noopener\\"><img src=\\"https://github.githubassets.com/images/icons/emoji/unicode/1f4af.png?v8.png\\" alt=\\"100\\" class=\\"emoji\\" loading=\\"lazy\\"></a></p>"`;

exports[`Emoji Ignores emoji shorthand codes in code, pre, script, and template tags 1`] = `
"<pre>:100:</pre>

Expand Down
13 changes: 13 additions & 0 deletions test/integration/emoji.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,19 @@ describe('Emoji', function () {
expect(mainElm.innerHTML).toMatchSnapshot();
});

test('Ignores emoji shorthand codes in URIs while handling anchor content', async () => {
await docsifyInit({
markdown: {
homepage: 'Achor tags [:100:](http://docsify.js.org/:100:/)',
},
// _logHTML: true,
});

const mainElm = document.querySelector('#main');

expect(mainElm.innerHTML).toMatchSnapshot();
});

test('Ignores emoji shorthand codes in code, pre, script, and template tags', async () => {
await docsifyInit({
markdown: {
Expand Down