cerises: Created cerises

This is a tool to turn Markdown text to terminal-approporiate text
This commit is contained in:
2026-07-25 19:57:02 +03:00
parent c37eef42e4
commit f4db20520b
2 changed files with 110 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
# 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```"))