Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
fix: bug caused by html in codeblocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Mara-Li committed Jan 12, 2024
1 parent ad9bd43 commit 5b85a12
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions custom_attributes/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def convert_hashtags(config: Dict[str, str], line: str) -> str:
css = read_custom(config)
token = re.findall(r"#[\w\-_\/]+", line)
token = list(set(token))
print(token)
for tag in token:
if tag in css:
clean_line = line.replace(tag, "")
Expand Down Expand Up @@ -90,18 +89,21 @@ def convert_text_attributes(markdown: str, config: Dict[str, str]) -> str:
markdown = ""
code_blocks = False
for line in files_contents:
if code_blocks and (
if not code_blocks and (
line.startswith("```")
or re.search("</.*?>", line)
or re.search(r"^\s*```", line)
or (re.search("<.*?>", line) and not re.search("</.*?>", line))
or re.search(r"^\s*```(.*)", line)
):
code_blocks = False
elif (
code_blocks = True
print("START OF BLOCK ----- ", line)
elif code_blocks and (
line.startswith("```")
or re.search("<.*?>", line)
or re.search("</?.*?>", line)
or re.search(r"^\s*```", line)
):
code_blocks = True
code_blocks = False
print("END OF BLOCK ----- ", line)

elif (
re.search(r"#\w+", line)
and not re.search(r"(`|\[{2}|\()(.*)#(.*)(`|]{2}|\))", line)
Expand Down

0 comments on commit 5b85a12

Please sign in to comment.