
CommonMarkRender는 마크다운을 HTML로 렌더링하는 라이브러리입니다. 헤더 태그의 클래스를 지정하는 방법은 다음과 같습니다.
#hostingforum.kr
python
import commonmark
renderer = commonmark.HtmlRenderer()
parser = commonmark.Parser()
text = "# 헤더 1n## 헤더 2n### 헤더 3"
document = parser.parse(text)
html = renderer.render(document)
print(html)
위 코드는 마크다운의 헤더 태그를 HTML로 렌더링합니다. `#`의 개수에 따라 HTML 태그의 클래스가 자동으로 지정됩니다.
CommonMarkRender의 문서는 [공식 홈페이지](https://commonmark.org/)에서 확인할 수 있습니다.
2025-08-08 22:46