Some checks failed
Tests / Backend Tests (Python) (3.10) (push) Has been cancelled
Tests / Backend Tests (Python) (3.11) (push) Has been cancelled
Tests / Backend Tests (Python) (3.12) (push) Has been cancelled
Tests / Frontend Tests (JS) (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / All Tests Passed (push) Has been cancelled
19 lines
615 B
Python
19 lines
615 B
Python
import re
|
|
import os
|
|
|
|
docs_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'docs'))
|
|
schema_md_path = os.path.join(docs_dir, 'database_schema.md')
|
|
mmd_path = os.path.join(docs_dir, 'erd.mmd')
|
|
|
|
with open(schema_md_path, 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
match = re.search(r'```mermaid\n(.*?)```', content, re.DOTALL)
|
|
if match:
|
|
mermaid_code = match.group(1).strip()
|
|
with open(mmd_path, 'w', encoding='utf-8') as f:
|
|
f.write(mermaid_code)
|
|
print(f"Mermaid code extracted to {mmd_path}")
|
|
else:
|
|
print("Could not find mermaid block in database_schema.md")
|