Superscript and Subscript rendering using symbols#107
Conversation
Byron
left a comment
There was a problem hiding this comment.
Thanks a lot for contributing, it's much appreciated!
Everything looks good actually, and the test is particularly good to have. However, I'd just need a little tweak beyond my other comment:
- The first commit must be
feat!: …to indicate a breaking change due to the new struct field. That should also be mentioned in the commit message then so people know what exactly is breaking there. - Please remove the
tests:prefix, there is no need for this to go into the changelog.
Thanks again!
|
Thank you for the review - I shall make those changes tonight when I'm home. |
|
Thanks a lot! I also recommend rebasing as I have added full docs to be a better example for future contributions 😅. |
No worries, I always try my best to be a good citizen.
Oooh fancy. I shall be sure to do so, thank you. |
Superscript and subscript can be presented in markdown as: ^superscript^ and ~subscript~ respectively. This is not always turned on, and many people prefer the HTML tag form, however in order to round-trip markdown which uses the symbolic form we need an option to enable that. This feature is enabled via a new field in the `Options` struct. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
332b392 to
463b65a
Compare
|
I have rebased, added the doccomment, and updated the commit messages. I hope that's what you were after - if I've missed anything, please just yell. |
8fcc23d to
da3c701
Compare
|
Thanks for your help! I think that's it and I will create a new release right after merging. |
There was a problem hiding this comment.
Pull request overview
This PR adds support for rendering superscript and subscript using symbolic notation (^ and ~) instead of HTML tags (<sup> and <sub>), enabling byte-for-byte round-tripping of markdown documents that use pulldown-cmark's ENABLE_SUPERSCRIPT and ENABLE_SUBSCRIPT options.
- Adds a new
use_html_for_super_sub_scriptboolean option to control rendering format (defaults totruefor backward compatibility) - Updates rendering logic to output
^and~symbols when the option is set tofalse - Provides example usage through the stupicat tool with the
STUPICAT_SUB_SUPER_SYMBOLICenvironment variable
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/lib.rs | Adds the use_html_for_super_sub_script option to the Options struct and updates superscript/subscript rendering logic in both start and end tag handlers |
| examples/stupicat.rs | Updates to use cmark_with_options and cmark_resume_with_options, adding support for the STUPICAT_SUB_SUPER_SYMBOLIC environment variable |
| tests/cat.sh | Adds integration test for symbolic super/subscript rendering |
| tests/fixtures/symbolic-super-sub-script.md | Test input file with symbolic notation for super/subscript |
| tests/fixtures/snapshots/stupicat-symbolic-super-sub-script-output | Expected output snapshot for the symbolic notation test |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
da3c701 to
e2211a9
Compare
e2211a9 to
aba929c
Compare
|
And I can update my crate to use this release and all the tests still pass -- thank you so much @Byron |
pulldown-cmarkcan parse^superscript^and~subscript~and in order to be able to roundtrip that kind of thing, I thought it would be good to add an option to permit the use of^and~rather than<sup>and<sub>.This is my first time touching this project so please let me know if I've done anything awful, or if you need me to fix up my commit messages to fit your process more.