Skip to content
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

Printable unicode emoji #18

Merged
merged 16 commits into from
May 10, 2018
Merged

Printable unicode emoji #18

merged 16 commits into from
May 10, 2018

Conversation

yhatt
Copy link
Member

@yhatt yhatt commented May 7, 2018

In pre-released Marp, we have fought against the unicode emoji in exported PDF.

Pre-released Marp + Apple emoji + The old version of Chrome (Electron 1.x)

Apple emoji + Pre-released Marp

Apple emoji + Pre-released Marp + prerender directive

Marpit + Windows Segoe UI Emoji + Printing in the latest version of Chrome

  • Emoji will render in fallback version. It has not colored.
  • This behavior will bring a surprise, and disappoint the user expected to render emoji in colored.

Microsoft Emoji + Marpit

Microsoft Emoji + Marpit + Filter

Solution

In this PR, we will process a DOM tree generated by markdown-it and wrap unicode emoji by <span data-marpit-emoji></span> if printableEmoji option is true. We will style it to be able to render the original emoji by creating a stacking context through filter style.

Actually we don't want to change the original DOM structure, but we allowed it because this change will become an unobtrusive change.

ToDo

  • Define the default style of data-marpit-emoji in scaffold theme
  • Wrap unicode emoji by <span data-marpit-emoji></span> in the plugin
  • [ ] printableEmoji Initialize option (false by default)
    • Use printable option to keep colored emoji
  • Add test case

@yhatt
Copy link
Member Author

yhatt commented May 9, 2018

The first implement is committed but currently we deal with trial and error.

Besides this for better emoji support in theme, we are implementing PostCSS emoji font plugin to render colored emoji.

@yhatt
Copy link
Member Author

yhatt commented May 10, 2018

We are ready for printing the unicode emoji. The example output is here (Outputted on Windows).

# ❤️ Unicode emoji supports ❤️

❤️🧡💛💙💚💜

> The unicode emoji will render in low-resolution if you print slide deck to PDF in Chrome. So we are going to support the shortcode of emoji to render in a vector image.

We have not employed an approach of the @font-face PostCSS plugin because that won't be necessary this time.

@yhatt yhatt changed the title [WIP] Printable unicode emoji Printable unicode emoji May 10, 2018
yhatt added 5 commits May 11, 2018 01:47
The previous version of Chrome has not rendered emoji in bold weight.
But it has been fixed in current version. `font-weight: bold` might
bring unexpected rendering about font weight if user use text based emoji
font like Symbola.

@see https://bugs.chromium.org/p/chromium/issues/detail?id=551843
@yhatt yhatt merged commit 2eb9892 into master May 10, 2018
@yhatt yhatt deleted the printable-unicode-emoji branch May 10, 2018 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant