Skip to content

Commit

Permalink
馃悰 Fix emphasis inside raw links bugs (#320)
Browse files Browse the repository at this point in the history
Changed from `re.match` to `re.search` to work as intended.
  • Loading branch information
tsutsu3 committed Jan 11, 2024
1 parent df3aadf commit 15290f9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion markdown_it/rules_inline/linkify.py
Expand Up @@ -27,7 +27,7 @@ def linkify(state: StateInline, silent: bool) -> bool:
):
return False

if not (match := SCHEME_RE.match(state.pending)):
if not (match := SCHEME_RE.search(state.pending)):
return False

proto = match.group(1)
Expand Down
35 changes: 35 additions & 0 deletions tests/test_port/fixtures/linkify.md
Expand Up @@ -211,3 +211,38 @@ google\.com
.
<p>google.com</p>
.

Issue [#300](https://github.com/executablebooks/markdown-it-py/issues/300) emphasis inside raw links (underscore) at beginning of line
.
http://example.org/foo._bar_-_baz This works
.
<p><a href="http://example.org/foo._bar_-_baz">http://example.org/foo._bar_-_baz</a> This works</p>
.

Issue [#300](https://github.com/executablebooks/markdown-it-py/issues/300) emphasis inside raw links (underscore) at end of line
.
This doesnt http://example.org/foo._bar_-_baz
.
<p>This doesnt <a href="http://example.org/foo._bar_-_baz">http://example.org/foo._bar_-_baz</a></p>
.

Issue [#300](https://github.com/executablebooks/markdown-it-py/issues/300) emphasis inside raw links (underscore) mix1
.
While this `does` http://example.org/foo._bar_-_baz, this doesnt http://example.org/foo._bar_-_baz and this **does** http://example.org/foo._bar_-_baz
.
<p>While this <code>does</code> <a href="http://example.org/foo._bar_-_baz">http://example.org/foo._bar_-_baz</a>, this doesnt <a href="http://example.org/foo._bar_-_baz">http://example.org/foo._bar_-_baz</a> and this <strong>does</strong> <a href="http://example.org/foo._bar_-_baz">http://example.org/foo._bar_-_baz</a></p>
.

Issue [#300](https://github.com/executablebooks/markdown-it-py/issues/300) emphasis inside raw links (underscore) mix2
.
This applies to _series of URLs too_ http://example.org/foo._bar_-_baz http://example.org/foo._bar_-_baz, these dont http://example.org/foo._bar_-_baz http://example.org/foo._bar_-_baz and these **do** http://example.org/foo._bar_-_baz http://example.org/foo._bar_-_baz
.
<p>This applies to <em>series of URLs too</em> <a href="http://example.org/foo._bar_-_baz">http://example.org/foo._bar_-_baz</a> <a href="http://example.org/foo._bar_-_baz">http://example.org/foo._bar_-_baz</a>, these dont <a href="http://example.org/foo._bar_-_baz">http://example.org/foo._bar_-_baz</a> <a href="http://example.org/foo._bar_-_baz">http://example.org/foo._bar_-_baz</a> and these <strong>do</strong> <a href="http://example.org/foo._bar_-_baz">http://example.org/foo._bar_-_baz</a> <a href="http://example.org/foo._bar_-_baz">http://example.org/foo._bar_-_baz</a></p>
.

emphasis inside raw links (asterisk) at end of line
.
This doesnt http://example.org/foo.*bar*-*baz
.
<p>This doesnt <a href="http://example.org/foo.*bar*-*baz">http://example.org/foo.*bar*-*baz</a></p>
.

0 comments on commit 15290f9

Please sign in to comment.