remarkjs / remark-rehype

plugin that turns markdown into HTML to support rehype
https://remark.js.org
MIT License
258 stars 18 forks source link

Add options.footnoteSymbol to API for less opinionated footnote styling #32

Closed tjex closed 1 year ago

tjex commented 1 year ago

Initial checklist

Problem

Currently the symbol used in mdast-util-to-hast gets rendered as an emoji arrow.

Screen Shot 2023-06-01 at 15 17 29

As discussed here, the rendering of the arrow seems to depend on the host environment. On my Astro site they get rendered as an emoji arrow as above (where I only use the default markdown packages remark-gfm and smarty-pants, but here on github, footnotes get rendered as a normal text arrow ^1.

Solution

As described above, the rendering behaviour due to the host environment is inconsistent. Emojis are also a very opinionated styling. I therefore think it would be great to implement a method for setting a custom symbol in place of the text arrow. For example, simply adding a different arrow for me, maintains that arrow upon rendering.

mdast-util-to-hast/lib/footer.js line: 53

- children: [{type: 'text', value: '↩'}]
+ children: [{type: 'text', value: '⤴ '}]`
Screen Shot 2023-06-01 at 15 09 14

This could look like:

options.footerSymbol = '⤴';

Which would simply replace the arrow symbol in mdast-util-to-hast/lib/footer.js

Alternatives

Other than manually editing the mdast-util-to-hast/lib/footer.js file in node_modules, I don't think so.

wooorm commented 1 year ago

Yep, will get to this in a bit. It’s already implemented in micromark-extension-gfm-footnote and markdown-rs

As discussed here, the rendering of the arrow seems to depend on the host environment

Hmm, it’s more: in the same way that the host may define which font is used for your website. You can use CSS to style your website. And you can use CSS for this too. See also https://css-tricks.com/text-that-sometimes-turns-to-emojis/. The fact that this happens is that GitHub uses the exact same character, but displays it differently from your site

tjex commented 1 year ago

excellent! and thanks for the extra info :)

github-actions[bot] commented 1 year ago

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.

wooorm commented 1 year ago

Solved upstream, will be here in a bit!

tjex commented 1 year ago

legend! thanks mate :)