Skip to content

Conversation

@pferreir
Copy link
Contributor

Closes #553.

This seems to have been attempted in the past, but the PR seems to have gone stale. I'm not 100% sure about inlines.rs:1158, some clarification would be great.
Hope this helps, it's a much-needed feature.

Copy link
Owner

@kivikakk kivikakk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great! One minor change needed, but otherwise all looks very good.

One comment: this currently parses both =x= and ==x== as valid highlights. Is this intentional?

"<p>This is <mark>important!</mark>.</p>\n",
"<p>This is <mark>very important</mark> OK?</p>\n",
"<p><mark>It is a\nshrubbery</mark></p>\n",
"<p>Vendo <mark>Opel Corsa <strong>em bom estado</strong></mark></p>\n"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:D

b'\'' => 4,
b'_' => 5,
b'*' => 6 + (if c.can_open { 3 } else { 0 }) + (c.length % 3),
b'*' => 7 + (if c.can_open { 3 } else { 0 }) + (c.length % 3),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should leave this as-is, otherwise the c.can_open with c.length == 2 case will overlap with the = case (both giving an index of 12).

Suggested change
b'*' => 7 + (if c.can_open { 3 } else { 0 }) + (c.length % 3),
b'*' => 6 + (if c.can_open { 3 } else { 0 }) + (c.length % 3),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's actually a typo. I originally meant to place the = before that, but then changed my mind and forgot to change it back. Thanks for spotting it!

@kivikakk
Copy link
Owner

kivikakk commented Nov 1, 2025

Thank you so much for this! One minor change needed and one query, otherwise ready to go. :)

@pferreir
Copy link
Contributor Author

pferreir commented Nov 3, 2025

One comment: this currently parses both =x= and ==x== as valid highlights. Is this intentional?

No, not at all. I guess that strikethrough does work with only one ~? Is it only a matter of being more specific about the number of characters here?

Actually, let me add a test case for that.

@kivikakk
Copy link
Owner

kivikakk commented Nov 3, 2025

I guess that strikethrough does work with only one ~?

It does, yep!

Is it only a matter of being more specific about the number of characters here?

That should do it; you'll probably want to separate the strikethrough and highlight cases there!

@pferreir
Copy link
Contributor Author

pferreir commented Nov 3, 2025

OK, I think I figured it out. I see you also made some changes in the meantime. I hope I didn't mess the rebase up.

@kivikakk kivikakk enabled auto-merge November 3, 2025 08:44
@kivikakk
Copy link
Owner

kivikakk commented Nov 3, 2025

This is looking excellent. Thank you so much for your work on this!

@kivikakk kivikakk merged commit 9846f7b into kivikakk:main Nov 3, 2025
22 checks passed
@pferreir
Copy link
Contributor Author

pferreir commented Nov 3, 2025

Thanks!

@pferreir pferreir deleted the add-highlight branch November 3, 2025 09:03
@kivikakk
Copy link
Owner

This was released in Comrak v0.48.0!

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.

Highlight extension

2 participants