-
-
Notifications
You must be signed in to change notification settings - Fork 503
Add support for normalizing Markdown #32
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
Conversation
|
Is there a blocking issue on PR? Or is there anything we can help out with? This would be a great feature to have -- as I would love to be able to programmatically create a |
|
Nothing blocking, just my limited spare time and lower personal interest for this specific feature. |
|
I'd like too help out on it - could you provide any overview of what is left? |
|
@eamodio sure, you are welcome. The first round is to support the core CommonMark syntax. The current commit changes on my branch contains some work for this (but still some syntaxes are not supported/well supported, like escape characters - I can explain later how to implement it) |
|
I just stumbled over this. I need something similar (I want to analyze the AST, fetch some stuff from it, and then serialize some parts of the AST (normalized or not). What is the progress? How heavy would this be to complete it? 2 hours, 10 hours, 20 hours? Willing to help out. |
I have no spare-time to work on this (as I have no personal requirement for this feature), so no progress has been done since I started to prototype the idea. For the core Markdown features (CommonMark only), I guess it requires a few hours of work (with tests...etc.). For all the extensions, quite more. |
|
Feel free to branch from my original PR |
|
I forked the repo and the normalize branch and saw into what is missing. This is my view (correct me if I am wrong)
Questions @xoofx
|
|
About normalization, it is just options to modify the way is printed back to markdown (like limit the column of paragraphs). You don't have to worry too much of it at this point. The original PR is very far from complete even for the renderers that were implemented. It was just a bootstrap to check how much work it would require and if there was any changes required to some existing classes (like handling the indent). Most likely there are missing TODO as well.
Can't remember the state of each, so you have to check them. The CommonMark part is quite limited, so it is only a few classes.
yes
we will (for the part specific with options activated, like limit column). One possible automated part for all tests is to output some markdown, re-feed it to the parser, re-output it and check that it doesn't shift.
I don't know, but "normalized" is nothing more than just a few rendering options. We have the freedom to add whatever is relevant for common use cases. We will see which one are valuable. Obviously, limit the width could have an impact on many renderers, so some normalization are more generally intrusive than others (e.g a normalization could work on list numbering for example).
They should be part of the rendering as well... not sure exactly what do you imply?
Sure, again, the original PR was a very small proof of concept and in the early stage of a WIP. |
- Code fences with attributes - Escaping inline code - Escaping link titles - Encode hard line breaks - HTML Entity emitting - List intend.
|
I have now unit tests for the straight forward things and fixed the bugs and TODOs so far. I will go ahead by ...
|
|
@xoofx can you take a look at https://github.com/tthiery/markdig/blob/normalize/src/Markdig.Tests/TestNormalize.cs I am curious about your opinion in testing AST to nomalized Markdown? I find the AST very hard to work with (I know.. damn youth... we enjoyed XLinq to much ;)). Is there a better way to annotate that? Or should we better base testing on alernative-to-normalizet text cases. |
Yeah, it will be too laborious. I would prefer if we could test as I started by checking plain markdown text:
|
|
Okay, understood. How far should normalization go? I think I will start to support the variations offered by the AST (e.g. different fencing characters for a |
# Conflicts: # src/Markdig.Tests/Markdig.Tests.csproj
Add support for normalize (core CommonMark for now)
|
Closing this issue as the first part (core CommonMark) is handled by the PR #154 which was a continuation of this PR. Will open a separate issue to track the remaining work |
Related to issue #17
This is still in wip.