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

Support ^superscript^ ~subscript~ and ==highlight== #238

Merged
merged 2 commits into from Mar 23, 2022

Conversation

tomidery
Copy link

I'm using Discount in a simple content server to render Markdown files to HTML. I tried to make it fully server side solution without using javascript on the client side. The Markdown pages are authored using Typora. I found that Discount is not 100% compatible with the editor:

  • superscript in Typora (and actually other Markdown implementations) expect ^ to be used before and after the text, e.g. x^2^
  • superscript in Typora does not expect the brackets ()
  • Discount does not support subscript e.g. H2O
  • Discount does not support ==highlighting text==
    There are more differences, and Typora also lacks some of Discount's features, but I wanted at least to implemented these 3 listed above.

You will find my attempt in this pull request. I would like to hear your comments and whether you consider accepting my changes.

Note that all 3 formatting features respond to the single configuration flag which was initially used only for superscript.

@Orc
Copy link
Owner

Orc commented May 12, 2021

Can you redo this feature request by surrounding the changes with #ifdefs? eg:

#ifdef TYPORA
... your feature ...
#else /* !TYPORA */
... my feature ...
#endif /*TYPORA*/

This is because this is a moderately large change from current behavior and if it's intended to be a backend for typora I'd prefer that it be build specifically as a backend for typora.

@Orc Orc self-assigned this May 12, 2021
@Orc Orc added this to the deer in the headlights milestone May 12, 2021
@tomidery
Copy link
Author

tomidery commented May 12, 2021 via email

@baltitenger
Copy link

@tomidery In other tools, ==text== results in <mark>text</mark>, which is better than hardcoding a background color in my opinion.

Use conditional compilation for superscript syntax:
 - with TYPORA flag it is new syntax: x^y^
 - without TYPORA flag it is original syntax: x^y
@tomidery
Copy link
Author

I updated the code in this PR to include the conditional compilation for x^y syntax and used for highlights.

@Orc Orc merged commit 769d655 into Orc:v2maint Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants