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

More CommonMark compatibility, support for code fences and tests #13

Open
wants to merge 31 commits into
base: master
Choose a base branch
from

Conversation

karlb
Copy link
Contributor

@karlb karlb commented Jul 5, 2020

These are all changes in my smu fork. After the recent merge, the changes are mostly:

  • Support for code fences
  • Improved CommonMark compatibility. E.g.
    • Improved spec compliance for lists
    • Nesting code block in blockquotes works
    • No backslash escapes in code blocks
    • Use first number as start number for ordered lists
  • Added a simple test suite to check for compliance and avoid regressions

If you don't want to merge some parts or need smaller PRs to merge, let me know.

karlb added 30 commits July 5, 2020 12:26
Running `make test` will show the differences to the committed output,
so that changes to smu's output become visible.
It shows up nicely n github and similar platforms this way.
Otherwise github will render it as markdown which is
a) not exactly the same rendering as smu
b) not helpful for explaining the in/output in many cases
Previously the paragraph detector included the code fences in the
paragraph up to the first empty line. This worked for trivial cases, but
broke an many real world cases.

I introduce regexes to to this project in this PR. Hopefully, this does
not bring any meaningful downsides I don't know about.
See change in `testdoc.html`
Describe the differences to the original smu as suggested by @avih.
This provides a nice github pages website where users can read the
rendered version of the README.
* Tabs for indentation, white-space for alignment
* Space after if, while, etc.
* Sort imports
There was one line break too much in the output.
This is a preparation step for allowing `\<` escapes.
Code blocks should print all backslashes. For now, backslash escapes of
backticks are still allowed, but those should be removed in a next step.
This is against commonmark:
https://spec.commonmark.org/0.29/#example-303

Doing it in hprint was also bad, since that function is used in other
places where no escaping is intended, too.
No need to call hprint here, all HTML substitution is already done in
`doreplace`.
That can also be handled by a replace.
I'd like this branch to be merged upstream, so comparing the differences
won't make any sense in the README, anymore.
@B4rb3rouss
Copy link

I just started to write code fence support, so thank you a lot for this ! It will be useful for long code blocks.

@SoulPrudya
Copy link

Please, could you merge it?

Maybe, it would be better, if you provide your changes as several PRs.

@ImmortalityDark
Copy link

Could you please review and consider this merge request? CommonMark support in smu will be great.

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

Successfully merging this pull request may close these issues.

4 participants