MyST-Parser icon indicating copy to clipboard operation
MyST-Parser copied to clipboard

Add support for strikethrough

Open nemani opened this issue 4 years ago • 3 comments

Is your feature request related to a problem? Please describe.

While markdown-it-py seems to support strikethrough, looks like myst_parser does not. I tried to enable it locally in main.py but then it errored saying there is not rule to render s. Docutils doesnt have any node for the same, so not sure how to go about adding it.

Describe the solution you'd like

Strikeout should work by rendering a <s> </s> or <del> </del> tags

nemani avatar Jul 14 '21 11:07 nemani

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

welcome[bot] avatar Jul 14 '21 11:07 welcome[bot]

Heya, yeh its a bit of pain, because unfortunately docutils/sphinx does not directly support strike-through, e.g. for bold/strong text we can directly convert it to a nodes.strong(*child_nodes) AST object, then sphinx will handle converting that to the output format (HTML, TeX, ...). For strike-through then MyST would currently have to use a custom node like nodes.strikethrough(*child_nodes), then also provide the default logic for the different output formats. When using specific HTML themes as well, it may also get tricky, because they will likely not have any specific CSS to handle this.

I would certainly like to have it, but ideally this would be an upstream addition to docutils/sphinx.

chrisjsewell avatar Jul 16 '21 09:07 chrisjsewell

Perhaps as a start this could be a simple "sphinx-strikethrough" package that would add a strike through inline node via a role, and this could be an optional deoendency for the Myst parser similar to the linkify syntax?

choldgraf avatar Jul 16 '21 10:07 choldgraf

the strikethrough extension has now been available for a while: https://myst-parser.readthedocs.io/en/latest/syntax/optional.html#strikethrough

chrisjsewell avatar Mar 01 '23 07:03 chrisjsewell