25 lines
981 B
Python
25 lines
981 B
Python
# This file is named that because I am eating cherries :3
|
|
|
|
import json
|
|
|
|
with open("cerisesfonts/h1.json", "r") as file:
|
|
font_h1 = json.load(file)
|
|
|
|
def process(text: str) -> str:
|
|
lines = text.split("\n")
|
|
inside_code_block = False
|
|
for i, line in enumerate(lines):
|
|
if line == "```":
|
|
inside_code_block = not inside_code_block
|
|
if not inside_code_block:
|
|
if line[0:2] == "# ":
|
|
final_data = ["", ""]
|
|
for char in line[2:]:
|
|
if char in font_h1:
|
|
char_data = font_h1[char].split("\n")
|
|
for i2, data_line in enumerate(final_data):
|
|
final_data[i2] = data_line + char_data[i2]
|
|
lines[i] = "\n".join(final_data)
|
|
return "\n".join(lines)
|
|
|
|
# print(process("# Hello Guys 123\nThis is a cool Markdown file. Isn't it so cool?\n```\nThis is a code block\n# This is a code comment, not a heading!\n```")) |