(no commit message)
This commit is contained in:
25
utils/display.py
Normal file
25
utils/display.py
Normal file
@@ -0,0 +1,25 @@
|
||||
"""Display and UI utilities for nanocode."""
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
# ANSI colors
|
||||
RESET = "\033[0m"
|
||||
BOLD = "\033[1m"
|
||||
DIM = "\033[2m"
|
||||
BLUE = "\033[34m"
|
||||
CYAN = "\033[36m"
|
||||
GREEN = "\033[32m"
|
||||
YELLOW = "\033[33m"
|
||||
RED = "\033[31m"
|
||||
MAGENTA = "\033[35m"
|
||||
|
||||
|
||||
def separator():
|
||||
"""Return a horizontal separator line that fits the terminal width."""
|
||||
return f"{DIM}{'─' * min(os.get_terminal_size().columns, 80)}{RESET}"
|
||||
|
||||
|
||||
def render_markdown(text):
|
||||
"""Convert basic markdown bold syntax to ANSI bold."""
|
||||
return re.sub(r"\*\*(.+?)\*\*", f"{BOLD}\\1{RESET}", text)
|
||||
Reference in New Issue
Block a user