-
-
Notifications
You must be signed in to change notification settings - Fork 398
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
Commonmarker 1.0 support #1540
base: main
Are you sure you want to change the base?
Commonmarker 1.0 support #1540
Changes from all commits
2c0bac2
3472342
0e274a0
9e869c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -30,6 +30,7 @@ def clear_markup_cache | |||||||||||||||||||||||||||||||||||||||||
{:lib => :maruku, :const => 'Maruku'}, | ||||||||||||||||||||||||||||||||||||||||||
{:lib => :'rpeg-markdown', :const => 'PEGMarkdown'}, | ||||||||||||||||||||||||||||||||||||||||||
{:lib => :rdoc, :const => 'YARD::Templates::Helpers::Markup::RDocMarkdown'}, | ||||||||||||||||||||||||||||||||||||||||||
{:lib => :commonmarker, :const => 'Commonmarker'}, | ||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is problematic, as the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
yard/lib/yard/templates/helpers/markup_helper.rb Lines 91 to 110 in ad2c1c4
Even if it’s not, v1.0 Footnotes
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Unfortunately this would be a breaking change and would need a major version bump-- we're very unlikely to major version bump YARD just for a single (optional) markup library. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. YARD is currently still in 0.x versions, so I’m not sure what you meant by ‘major’. That said, together with #1540 (comment), I see your concern. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
YARD's 0.x releases are a major version. Believe it or not, there was a time before "SemVer", and YARD predates the existence of the now-popular semantic versioning specification, along with its arbitrary distinction that only 1.0+ are considered API stable. YARD's 0.x releases are considered a stable API. "0" is the current major version for YARD, we simply use 0-based indexing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We might wanna add one. But for now, …
… I’ll add a comment in the code since it’s now linked in the README.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Actually, we might not be able to support both Commonmarker and CommomMarker at all. |
||||||||||||||||||||||||||||||||||||||||||
{:lib => :commonmarker, :const => 'CommonMarker'} | ||||||||||||||||||||||||||||||||||||||||||
], | ||||||||||||||||||||||||||||||||||||||||||
:textile => [ | ||||||||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -26,7 +26,7 @@ | |||||||||||
|
||||||||||||
before(:each) do | ||||||||||||
if html_renderer.markup_class(markup).nil? | ||||||||||||
skip "Missing markup renderer #{markup}" | ||||||||||||
raise "Missing markup renderer #{markup}" | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should stay as skip for systems that do not have the dependencies installed (testing outside of bundle exec). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am unable to run
Lines 9 to 13 in ad2c1c4
|
||||||||||||
end | ||||||||||||
end | ||||||||||||
|
||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,26 +72,17 @@ | |
|
||
include_examples 'shared examples for markdown processors' | ||
|
||
|
||
it 'generates anchor tags for level 2 header' do | ||
expect(rendered_document).to include('<h2 id="example-code-listings">Example code listings</h2>') | ||
end | ||
|
||
it 'does not create line break via backslash' do | ||
expect(rendered_document).to include("commonmark line break with\\\na backslash") | ||
end | ||
end | ||
|
||
describe 'CommonMarker', if: RUBY_VERSION >= '2.3' do | ||
describe 'Commonmarker', if: RUBY_VERSION >= '2.3' do | ||
let(:markup) { :markdown } | ||
let(:markup_provider) { :commonmarker } | ||
|
||
include_examples 'shared examples for markdown processors' | ||
|
||
it 'generates level 2 header without id' do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should remain but should be scoped to CommonMarker There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why? Does it have an impact?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Not when we're explicitly testing system integration. The fact that this behavior changes is exactly why we have tests. An id-less h2 heading actually has implications for downstream YARD code, since we have special code paths for heading id attributes. Actually, expanding this comment outward, it seems like this change removes all integration tests for CommonMarker, which means we're now only testing Commonmarker 1.0. This is also insufficient. We should keep the old tests for CommonMarker and add the new ones for this 1.0 version, not replace. tl;dr we need to test both CommonMarker / Commonmarker implementations. Not just one. You can remove the h2 test for Commonmarker 1.0 if you want, but both libraries should be integration tested. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
YARD relies on this IDs though, that's the issue, and that's why we test. |
||
expect(rendered_document).to include('<h2>Example code listings</h2>') | ||
end | ||
|
||
it 'creates line break via backslash' do | ||
expect(rendered_document).to include("commonmark line break with<br />\na backslash") | ||
end | ||
|
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.
However, preference for the provider’s highlighting is outside of this PR’s scope.