Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 15290f9

Browse files
authored
🐛 Fix emphasis inside raw links bugs (#320)
Changed from `re.match` to `re.search` to work as intended.
1 parent df3aadf commit 15290f9

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

‎markdown_it/rules_inline/linkify.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def linkify(state: StateInline, silent: bool) -> bool:
2727
):
2828
return False
2929

30-
if not (match := SCHEME_RE.match(state.pending)):
30+
if not (match := SCHEME_RE.search(state.pending)):
3131
return False
3232

3333
proto = match.group(1)

‎tests/test_port/fixtures/linkify.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,38 @@ google\.com
211211
.
212212
<p>google.com</p>
213213
.
214+
215+
Issue [#300](https://github.com/executablebooks/markdown-it-py/issues/300) emphasis inside raw links (underscore) at beginning of line
216+
.
217+
http://example.org/foo._bar_-_baz This works
218+
.
219+
<p><a href="http://example.org/foo._bar_-_baz">http://example.org/foo._bar_-_baz</a> This works</p>
220+
.
221+
222+
Issue [#300](https://github.com/executablebooks/markdown-it-py/issues/300) emphasis inside raw links (underscore) at end of line
223+
.
224+
This doesnt http://example.org/foo._bar_-_baz
225+
.
226+
<p>This doesnt <a href="http://example.org/foo._bar_-_baz">http://example.org/foo._bar_-_baz</a></p>
227+
.
228+
229+
Issue [#300](https://github.com/executablebooks/markdown-it-py/issues/300) emphasis inside raw links (underscore) mix1
230+
.
231+
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
232+
.
233+
<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>
234+
.
235+
236+
Issue [#300](https://github.com/executablebooks/markdown-it-py/issues/300) emphasis inside raw links (underscore) mix2
237+
.
238+
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
239+
.
240+
<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>
241+
.
242+
243+
emphasis inside raw links (asterisk) at end of line
244+
.
245+
This doesnt http://example.org/foo.*bar*-*baz
246+
.
247+
<p>This doesnt <a href="http://example.org/foo.*bar*-*baz">http://example.org/foo.*bar*-*baz</a></p>
248+
.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /