-
-
Notifications
You must be signed in to change notification settings - Fork 28
[k1LoW/deck#448] fix link text including underscore is partially missing #449
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
[k1LoW/deck#448] fix link text including underscore is partially missing #449
Conversation
|
Your edit is probably correct. Could you please reopen it? ref. https://spec.commonmark.org/0.31.2/#link-reference-definitions |
I imagine you've strictly enabled hash pinning, but since the homebrew/actions/setup-homebrew tag doesn't exist, the workflow is broken. Could you please check this? @k1LoW |
Sorry! I've disabled it! |
thanks, I will check failed test |
|
It's recommended to include test cases in the golden tests for clarity. |
md/md.go
Outdated
// Concatenate all children values for links | ||
var linkText string | ||
for _, child := range children { | ||
linkText += child.Value |
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.
Here, rather than simply concatenating the text, we need to process each child element by converting it into a fragment and adding it, similar to how we handle emphasis. This is to preserve the styles within the link text.
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.
thanks, I think so too, and will fix it.
- Changed implementation to create separate fragments for each text node - This preserves formatting (bold, italic, code) within links - Added comprehensive tests for links with underscores and formatting
9367384
to
a42bfb0
Compare
- Replaced all example.com URLs with github.com/k1LoW/deck in link.md.golden - Ensures consistency across all test data
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.
Great!
No issues with the code changes.
Please adjust the test code.
- md/link_test.go duplicates the golden test, so let's remove it
- Should we change
[**bold_start** normal_middle **bold_end**]
to[**bold_start** normal_middle __bold_end__]
?- This time, the issue stemmed from the underscore being a special character in Markdown that triggers token splitting. We want to ensure our test cases cover this scenario as well.
- Remove md/link_test.go as it duplicates golden test functionality - Change **bold_end** to __bold_end__ in test case to better test underscore handling (double underscores also create bold formatting and test token splitting)
thanks, good test case. I fixed for it. |
Great work. |
WHAT
SSIA
WHY
link only handled the first fragment (underscore is one of example)
#448
Note
golden test
https://github.com/k1LoW/deck/blob/0e34436b4952af625c8b104f83573e5299897fb2/testdata/link.md