Skip to content

Commit 98a1c0a

Browse files
committed
Fix url plugin render, #308
1 parent 979d6d3 commit 98a1c0a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

Diff for: mistune/inline_parser.py

+4
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ def parse_linebreak(self, m, state):
193193

194194
def parse_inline_html(self, m, state):
195195
html = m.group(0)
196+
if html.startswith('<a '):
197+
state['_in_link'] = True
198+
if html.startswith('</a>'):
199+
state['_in_link'] = False
196200
return 'inline_html', html
197201

198202
def parse_text(self, text, state):

Diff for: mistune/plugins/extra.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88

99

1010
def parse_url_link(inline, m, state):
11-
return 'link', escape_url(m.group(0))
11+
url = m.group(0)
12+
if state.get('_in_link'):
13+
return 'text', url
14+
return 'link', escape_url(url)
1215

1316

1417
def plugin_url(md):

0 commit comments

Comments
 (0)