Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jun 2, 2023
1 parent 05c6654 commit 3a86d3b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions markdown_it/rules_core/text_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ def text_join(state: StateCore) -> None:
"""Join raw text for escape sequences (`text_special`) tokens with the rest of the text"""

for inline_token in state.tokens[:]:

if inline_token.type != 'inline':
if inline_token.type != "inline":
continue

# convert text_special to text and join all adjacent text nodes
new_tokens: list[Token] = []
for child_token in (inline_token.children or []):
if child_token.type == 'text_special':
child_token.type = 'text'
if child_token.type == 'text' and new_tokens and new_tokens[-1].type == 'text':
for child_token in inline_token.children or []:
if child_token.type == "text_special":
child_token.type = "text"
if (
child_token.type == "text"
and new_tokens
and new_tokens[-1].type == "text"
):
new_tokens[-1].content += child_token.content
else:
new_tokens.append(child_token)
Expand Down

0 comments on commit 3a86d3b

Please sign in to comment.