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

Render __ and ^^ wrapped text as sub/superscript in Markdown Preview #21591

Closed
1 task done
caiigee opened this issue Dec 5, 2024 · 1 comment
Closed
1 task done

Comments

@caiigee
Copy link

caiigee commented Dec 5, 2024

Check for existing issues

  • Completed

Describe the feature

To the best of my knowledge, there is currently no way to write sub/superscript text in Markdown for it to be rendered in the preview. This a feature that other Markdown editors provide (e.g. Joplin). The syntax for sub/superscript text is super important for scientific note taking as that kind of subject involves a lot of sub/superscript text.

Right now, I resort to using Compose sequences, which is very much not ideal.

I suggest to use the underscore _ and circumflex ^ as the "escape" characters for sub/superscript, respectively. I understand that underscore wrapped text currently renders to italic but I find that weird as asterisk * wrapped text also renders to italic. There is clearly potential here for better syntax rules.

On a sidenote, I find it very strange that Zed's markdown preview does not render HTML. For example, I tried writing "Ca<sup>2+</sup>" and the preview rendered only "Ca". Every other Markdown editor I used previously could render HTML elements.

Environment

Zed: v0.163.2 (Zed)
OS: Linux Wayland nixos 25.05
Memory: 14.9 GiB
Architecture: x86_64
GPU: AMD Radeon 680M (RADV REMBRANDT) || radv || Mesa 24.2.6

If applicable, add mockups / screenshots to help present your vision of the feature

H_2_O → H₂O
K^+^ → K⁺

@notpeter
Copy link
Member

notpeter commented Dec 6, 2024

I find it very strange that Zed's markdown preview does not render HTML.

Zed does not ship an embedded web view and so our Markdown Preview is a (limited) gpui-native Markdown renderer not a Markdown->HTML compiler + webview as is more common in apps that include a web browser.

I suggest to use the underscore _ and circumflex ^ as the "escape" characters for sub/superscript, respectively.

We are unlikely to implement non-standard characters like _ as a subscript and ^.
Our current target is compatibility is GitHub Flavored Markdown.

If we ship an HTML webview for Markdown that may support HTML <sup> / <sub> but in the meantime we still have a ways to go implementing core Markdown features. See:

I understand that's not the answer you're looking for, but I'd rather close as not planned than leave an issue open that we have no intention of (directly) working on in the near future. Thanks for filing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants