glushchenko / fsnotes

Notes manager for macOS/iOS
https://fsnot.es
MIT License
6.18k stars 455 forks source link

Support for Markdown superscripts/subscripts? #1493

Open mdaeron opened 1 year ago

mdaeron commented 1 year ago

Describe your feature request I am a researcher trying out FSNotes, and I work in isotopic chemistry, so my notes are full of subscripts and superscripts. Many scientists and engineers can probably say the same. It would be great if FSNotes offered some support for these, e.g. as ^14^C (14C) or H~2~O (H2O).

Additional context Bothe macOS and iOS versions would benefit.

tewe commented 1 year ago

Neither original Markdown nor the CommonMark standard used in FSNotes have syntax for sub- or superscript text.

If FSNotes added ^ or ~ those wouldn't work anywhere else, which seems like a bad idea for research notes.

MathJax can already be used to get something to render like your examples. Extensions for chemical formula exist, adding them could be requested.

mdaeron commented 1 year ago

Thanks for your answer. For the record, I find your point of view reasonable even if I personally diagree.

Neither original Markdown nor the CommonMark standard used in FSNotes have syntax for sub- or superscript text.

If FSNotes added ^ or ~ those wouldn't work anywhere else, which seems like a bad idea for research notes.

That syntax is from pandoc. In my (anecdotal) experience it is a de facto standard for Markdown sub/superscripts (e.g., PyMdown Extensions here and here). Granted, this is always in the context of Markdown extensions, and perhaps user-selectable extensions are out of scope for FSNotes (although they would be a really nice addition).

MathJax can already be used to get something to render like your examples. Extensions for chemical formula exist, adding them could be requested.

MathJax is semantically and typographically different, unfortunately, and renders particularly poorly in titles.

I'll look into extensions for chemistry, thanks. The tricky thing is to be able to apply sub/superscripts to arbitrary glyphs, like δ18Owater.

Thanks again for your response.

mdaeron commented 1 year ago

FWIW, thIS proposed super/subscript syntax is also used by Typora and ByWord, two of the more widely-used MarkDown editors for macOS.

Based on your earlier feedback, would you consider adding an optional extension to that effect? And, if so, how can I help? I'm no Swift developer, but I can look into suitable extensions if I understand the requirements on your end. What is the current status on Markdown extensions in FSNotes? Based on #500 it's not obvious to me whether any extension system is already implemented.

tewe commented 1 year ago

Personally I still use Markdown files I started 15 years ago, and I want to still be able to work with that content in another 15 years. So I'm not touching anything that isn't in 90% of all software across all operating systems.

But I'm not the author of this project, I just tried to contribute to this discussion.

FSNotes uses a third party library to handle Markdown. It's written in C. You can probably copy and adjust this file.

gingerbeardman commented 1 year ago

CommonMark is great for getting a ratified spec of Markdown. But, you'll find they are reluctant to add any extensions.

We use the Swift port wrapper https://github.com/KristopherGBaker/libcmark_gfm so there is a second hoop to jump through.

Maybe there's a better way we can do extensions to Markdown for FSNotes, but we've not found it so far.

tewe commented 1 year ago

It's not really a port to Swift, just a thin wrapper around a copy of the C code. And Oleksandr already forked it, so he could easily merge the adjustment I mentioned. More technical debt, of course.