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

Follow CommonMark spec. #343

Merged
merged 9 commits into from
Dec 29, 2015
Merged

Follow CommonMark spec. #343

merged 9 commits into from
Dec 29, 2015

Conversation

matthid
Copy link
Member

@matthid matthid commented Oct 1, 2015

Following Issues like #342 this would be a way to follow the spec.

With some tricks and a .tt file this PR adds code which parses the CommonMark spec html file (http://spec.commonmark.org/0.22/) and creates a test case for each example.

Usually I don't publish my work this early but I hope somebody is willing to help here (currently about 100 of the 600 new tests are passing).

I think this will close a lot of the open issues we have regarding markdown parsing.

@tpetricek Do you like the idea of keeping the generation code or should we only keep the tests?
I think it might be a good idea to be able to update to newer versions of the spec if needed.

@tpetricek
Copy link
Member

Nice! I do like the idea of automatically generating the tests from the specification so that we can handle potential changes. Too bad that the specification is not in a pretty machine readable format....

I have not used T4 before - does it work on mono too? An alternative would be to use TestCaseSource like in the existing test that compares PHP Markdown parser files. But I guess both will work here.

@matthid
Copy link
Member Author

matthid commented Oct 2, 2015

TestCaseSource is definitely the way to go, thank you for the hint. That's waaaay better :)

matthid and others added 7 commits October 6, 2015 20:01
…adPython' and 'CreateTestJson' to update automatically, disabled on regular builds). Use FSharp.Data Json Type Provider to generate the tests instead of parsing the html via regex. Disable some non-conforming tests and enable the 'Fenced code blocks' and 'Indented code blocks' section only (to get the build green faster, in the future we can enable the sections one by one).
@matthid
Copy link
Member Author

matthid commented Dec 29, 2015

Changed the test generation again and now use the official approach to run python to generate a test-validation json file (https://github.com/jgm/CommonMark#running-tests-against-the-spec).
The json file is consumed via the FSharp.Data json provider.
This simplifies the code a bit and gives some more metadata (like section of the spec for the given test).

I have changed FSF in a way to follow the spec for the 'Fenced code blocks' and 'Indented code blocks' sections (all other sections are disabled for now, see https://github.com/tpetricek/FSharp.Formatting/blob/master/tests/FSharp.Markdown.Tests/CommonMarkSpecTest.fs#L20)

It's probably better to merge this now and handle section by section in the future (we may even get contributions for other sections by other people).

@matthid matthid changed the title WIP: Follow CommonMark spec. Follow CommonMark spec. Dec 29, 2015
@matthid matthid merged commit bfc36d3 into master Dec 29, 2015
@matthid matthid deleted the follow_commonMark_spec branch February 4, 2018 15:36
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.

2 participants