Convert markdown report/guideline documents into professionally formatted DOCX Word files using python-docx, following the formatting rules defined in 보고서_템플릿_가이드_v5.md. This skill eliminates the need to manually write a Python conversion script each time.
When to Run
User provides a markdown file path and wants a .docx output
User says "convert to Word", "DOCX로 변환", "Word로 만들어줘", etc.
User invokes /md-to-docx path/to/file.md
Style Variants
There are two style variants. Ask the user if unclear which to use.
Report Style (default)
Based on create_ria_report.py / create_ria_premarketing.py.
Section headings: Roman numerals () via
Related Skills
I. II. III. IV.
add_section_heading(doc, text)
Table titles: Bracket format [제목] via add_table_title(doc, title)
Document title: add_title(doc, text) (18pt, bold, center - fixed)
def set_paragraph_format(paragraph, left_indent=None, first_line_indent=None,
space_before=None, space_after=None):
pf = paragraph.paragraph_format
if left_indent is not None:
pf.left_indent = Cm(left_indent)
if first_line_indent is not None:
pf.first_line_indent = Cm(first_line_indent)
if space_before is not None:
pf.space_before = Pt(space_before)
if space_after is not None:
pf.space_after = Pt(space_after)
def create_footnote(doc, paragraph, footnote_text):
# Creates a Word footnote with superscript reference
# Footnote content: 9pt 나눔명조
...
def save_doc_with_footnotes(doc, filepath):
# Must use this instead of doc.save() when footnotes are present
...
Script Generation Rules
File naming: create_{descriptive_name}.py based on the markdown filename
Output naming: {Descriptive_Name}.docx in the same directory or specified output path
Include only needed functions: Report style scripts don't need guideline-only functions and vice versa
Blank lines between sections: Always add doc.add_paragraph() between major sections (after section headings, between numbered item groups)
Bold keyword detection: When markdown has **keyword** rest of text, extract and pass as bold_keyword parameter
Table parsing: Parse markdown tables (| header | header |) into headers list and rows list of lists
Department/date line: Look for a line like 부서명(YYYY.MM) right after the title
Exceptions & Edge Cases
Case
Handling
Images in markdown ()
Insert placeholder text: [이미지: {alt}] as plain paragraph
Complex merged tables
Flag as manual adjustment needed; generate basic table
Emoji in headings
Strip emoji characters from heading text
Nested lists deeper than 3 levels
Flatten to dash bullets with increased indent
Footnote markers ([^1])
Convert to create_footnote() calls; use save_doc_with_footnotes()
No clear style indicators
Default to report style; inform the user
Mixed Korean/English text
Both handled by 나눔명조 font
Very long single-line content
python-docx handles wrapping automatically
Output Format
After successful execution, report:
Generated script path: create_*.py
Output DOCX path: *.docx
File size confirmation (should be > 10KB)
Number of pages (approximate based on content length)