글자 서식과 색상
굵기·기울임·밑줄·취소선·위아래 첨자·코드·반투명 색상 합성을 보여 줍니다.
입력과 출력 비교
실제 HTML/MathML 입력을 브라우저에서 보고, 생성된 DOCX를 LibreOffice로 내보낸 PDF와 비교하세요. 수식 편집은 DOCX를 Word에서 열어 확인할 수 있습니다.
브라우저 · HTML / MathML
HTML 미리보기 열기LibreOffice · PDF
PDF 열기Markdown·LaTeX 예제는 변환 과정에서 만든 HTML·MathML을 표시합니다. 브라우저의 MathML 지원, Word 스타일, 글꼴, 페이지 배치에 따라 표시가 달라질 수 있습니다.
PDF 패널은 페이지 이미지를 표시합니다. 확대·검색·텍스트 선택은 원본 PDF 열기를, 편집은 DOCX 다운로드를 이용하세요.
실행
예제 ZIP의 압축을 풀고 예제 의존성을 설치한 뒤, examples/ 폴더가 들어 있는 위치에서 실행하세요.
python -m examples.04_inline_formatting
전체 코드
"""04 inline formatting example."""
from mathml2docx import convert
from .support import save
document = convert("""<h1>Inline formatting</h1><p><b>Bold</b> <i>italic</i> <u>underline</u>
<del>removed</del> H<sub>2</sub>O x<sup>2</sup> <code>code()</code></p>
<p style="font-family:DejaVu Sans;font-size:14pt;color:navy">Named color and font</p>
<p style="background-color:blue"><span style="background-color:rgba(255,0,0,.5)">Purple blend</span></p>
<pre>first\tsecond\n indented code</pre>""")
save(document, "04_inline_formatting.docx")