-
-
Notifications
You must be signed in to change notification settings - Fork 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
url part of footnotes and links shall not be checked #102
url part of footnotes and links shall not be checked #102
Conversation
Signed-off-by: Laysa Uchoa <laysa.uchoa@gmail.com>
Signed-off-by: Laysa Uchoa <laysa.uchoa@gmail.com>
src/documentation/markdown.rs
Outdated
//Collapsed, | ||
//CollapsedUnknown, | ||
//Shortcut, | ||
//ShortcutUnknown, |
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.
I think we should have a test case for each of them, and then enable them one by one and see if special handling is necessary.
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.
yes, I agree. I will look into this and get back to you.
src/documentation/markdown.rs
Outdated
@@ -99,7 +131,8 @@ impl<'a> PlainOverlay<'a> { | |||
} | |||
} | |||
Event::Text(s) => { | |||
if code_block { | |||
if code_block || skip_text { | |||
skip_text = false |
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.
Are nested links ok? If so, would this cause issues here?
I think skip_text
is better placed in the End
tag, what do you think?
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.
can you write an example of a nested link? I can check it.
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.
I.e. [link of [links](./a)](./b)
(not sure this is legal, I did not check the spec)
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.
no, it does not support nested links. There is also not option in the pulldown-cmark
crate
src/documentation/markdown.rs
Outdated
|
||
#[test] | ||
fn markdown_reduction_mapping_inline_link() { | ||
const MARKDOWN: &str = r#" dyrck [I'm an inline-style link](https://www.google.com) artic"#; |
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.
const MARKDOWN: &str = r#" dyrck [I'm an inline-style link](https://www.google.com) artic"#; | |
const MARKDOWN: &str = r#" prefix [I am feeling ducky](https://duckduckgo.com) postfix"#; |
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.
prefix is not a misspelled word here
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.
You are on the right track 👍 - see details inline
Co-authored-by: Bernhard Schuster <bernhard@ahoi.io>
a63f0e9
to
646a0c2
Compare
88d78a3
to
313c350
Compare
src/documentation/markdown.rs
Outdated
// for now, only dealing with some links types | ||
match link_type { | ||
LinkType::Inline => {} | ||
LinkType::Autolink | LinkType::Email => skip_link_text = true, |
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.
I actually checked and I could not reproduce those types extra types. Either does not recognize them correct because they are not yet supported or I am getting the wrong examples to test (not sure, there are not many in the docs).
https://docs.rs/pulldown-cmark/0.7.2/pulldown_cmark/enum.LinkType.html
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.
Can you elaborate? I am not sure I can follow.
I have a small issue for footnote's since [^ ] are messing up with the mapping. Seems that I would need to add +2 in the beginning to count that. Otherwise, I have wrong marks. I added some debugging statements if it helps. I want to check it with you if I should do that.
Following up for the other links, I was not able to generate the events for them, such as you can see here for |
Could you add tests for all variants, even if they are not decided properly, that would at least be able to track changes in the cmark pulldown parser and avoid any fallout because of that. If you do that, then I could peek into that tomorrow. |
I opened an issue about this as it is not clear for me what they are from the docs: pulldown-cmark/pulldown-cmark#472 |
Since I added you as collaborator, you should be able to directly create branches here, so no need to fork anymore and I can just directly push adjustments to your branches :) |
There seems to be an issue with the link representation in cmark pulldown, I added comments here: pulldown-cmark/pulldown-cmark#472 I would suggest to continue dev in #105 and close this to ease the chores of rebase and refork and collaboration in general. |
Closes in favor of #105 |
What does this PR accomplish?
Remove check of links, but still keep title of inline links being checked.
Closes #97
Changes proposed by this PR:
Customize handling per each LinkType. Check if there is any title to be checked. Otherwise, do not push empty strings for checking as it generated wrong mapping IMO.
Footnote is not clear as the issue example is different from what is considered a footnote in the https://github.com/raphlinus/pulldown-cmark/ and https://www.markdownguide.org/extended-syntax/#footnotes I added a test to check the options for it. Right now, I am ignoring it.
Notes to reviewer:
I have some questions/concerns about footnote handling.
📜 Checklist
./demo
sub directory