-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add markdown printer #265
base: master
Are you sure you want to change the base?
Add markdown printer #265
Conversation
e60a510
to
5adf485
Compare
Cool feature @yasunariw ! I worked on something similar and you can see my findings here: #223 (comment). I think the conversion from utop # Omd.of_string "_*hello*_" |> Omd.to_markdown;;
- : string = "**hello**\n" Note this is after pinning What might be useful is the (very hacked together) testsuite I was running here: https://github.com/patricoferris/omd/tree/omd-print/tests. The idea was to parse the markdown normally and get the HTML, then use the |
Thanks for all the pointers @patricoferris ! I'll see what else I catch using your test method and report back. |
Thanks for the work on this important feature, @yasunariw and @patricoferris.
The most robust way I can think of is via some property based testing. If we had generator that constructed valid arbitrary My inclination is to suggest that we should expect any mergable solution to this feature to depend on the solution implemented for #223. |
let n = String.length c in | ||
if n > 0 && c.[String.length c - 1] <> '\n' then begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let n = String.length c in | |
if n > 0 && c.[String.length c - 1] <> '\n' then begin | |
let n' = String.length c in | |
if n' > 0 && c.[n'- 1] <> '\n' then begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise the nchar n buf
bellow adds too much backticks when closing the code block.
Need to remove the patches once it is merged and released
See #231.
This PR adds:
Omd.to_markdown
)--mode
to use Markdown instead of HTML as the output mode.The printer that existed in the 1.3.1 version was removed, so this PR is a rewrite for the 2.0 AST. The
add_string_escape_chars
function is reused from the previous version by @pw374 .So far, its behavior has been tested against manually constructed examples that cover all parts of the syntax. Please let me know if there is a robust way to add tests to the current setup. Thanks!