Evals / documents / Convert between formats

Word to a web page

Convert demo.docx to demo.html.

normalsingledeft doc to-html

The task

The reference answer shows the job can be done with deft. It is not an agent run.

deft doc to-html demo.docx -o demo.html

The files are not kept here, because demo.docx is under GPL-3.0. Its source is linked.

Input

No input file.

Reference output

No output yet.

How a result is judged (1 check)
  • text: file = "demo.html", contains = ["<table"]

Runs

CodexWithout deftPassed2026-11-07

Time
66s
New tokens
18.8k
Total input
114.0k
Output tokens
3.1k
Commands
6
Failed
0

Trace

  1. I’ll inspect the document and available conversion tools, then create `demo.html` in the current directory.

  2. ls -la && file demo.docx && command -v pandoc || true && command -v python3 || true
    output
    total 2568
    drwxr-xr-x@    3 user  staff       96 Nov  7 00:45 .
    drwx------@ 2101 user  staff    67232 Nov  7 00:45 ..
    -rw-r--r--@    1 user  staff  1311881 Nov  5 21:11 demo.docx
    demo.docx: Microsoft Word 2007+
    /usr/local/bin/python3
  3. python3 - <<'PY' import importlib.util for x in ['docx','mammoth']: print(x, bool(importlib.util.find_spec(x))) PY command -v libreoffice || command -v soffice || true
    output
    docx False
    mammoth False
  4. python3 - <<'PY' import zipfile z=zipfile.ZipFile('demo.docx') for n in z.namelist(): if n.startswith(('word/','docProps/')): print(n) PY
    output
    word/_rels/document.xml.rels
    word/document.xml
    word/footnotes.xml
    word/endnotes.xml
    word/fonts/font3.odttf
    word/media/image3.png
    word/fonts/font5.odttf
    word/fonts/font1.odttf
    word/fonts/font2.odttf
    word/media/image4.png
    word/fonts/font4.odttf
    word/fonts/font6.odttf
    word/media/image2.png
    word/media/image1.gif
    word/theme/theme1.xml
    word/settings.xml
    word/_rels/numbering.xml.rels
    word/_rels/fontTable.xml.rels
    docProps/core.xml
    word/numbering.xml
    word/styles.xml
    word/webSettings.xml
    word/fontTable.xml
    docProps/app.xml
  5. python3 - <<'PY' import zipfile,xml.etree.ElementTree as ET z=zipfile.ZipFile('demo.docx'); root=ET.fromstring(z.read('word/document.xml')) ns={'w':'http://schemas.openxmlformats.org/wordprocessingml/2006/main'} body=root.find('w:body',ns) for e in list(body): tag=e.tag.split('}')[-1] if tag=='p': t=''.join(x.text or '' for x in e.findall('.//w:t',ns)); sty=e.find('w:pPr/w:pStyle',ns) print('P', sty.attrib if sty is not None else '', repr(t[:220])) elif tag=='tbl': print('TABLE') else: print(tag) PY
    output
    P {'{http://schemas.openxmlformats.org/wordprocessingml/2006/main}val': 'Title'} 'Demonstration of DOCX support in calibre'
    bookmarkEnd
    bookmarkEnd
    P  'This document demonstrates the ability of the calibre DOCX Input plugin to convert the various typographic features in a Microsoft Word (2007 and newer) document. Convert this document to a modern ebook format, such as A'
    P  'There is support for images, tables, lists, footnotes, endnotes, links, dropcaps and various types of text and paragraph level formatting.'
    P  'To see the DOCX conversion in action, simply add this file to calibre using the “Add Books” button and then click “Convert”.  Set the output format in the top right corner of the conversion dialog to EPUB or AZW3 and cli'
    P  ''
    P {'{http://schemas.openxmlformats.org/wordprocessingml/2006/main}val': 'Heading1'} 'Text Formatting'
    P {'{http://schemas.openxmlformats.org/wordprocessingml/2006/main}val': 'Heading2'} 'Inline formatting'
    P  'Here, we demonstrate various types of inline text formatting and the use of embedded fonts.'
    P  'Here is some bold, italic, bold-italic, underlined and struck out  text. Then, we have a superscript and a subscript. Now we see some red, green and blue text. Some text with a yellow highlight. Some text in a box. Some '
    P  'A paragraph with styled text: subtle emphasis  followed by strong text and intense emphasis. This paragraph uses document wide styles for styling rather than inline text properties as demonstrated in the previous para
    … 9524 more characters
  6. python3 - <<'PY' import zipfile, xml.etree.ElementTree as ET z=zipfile.ZipFile('demo.docx') for x in ['word/_rels/document.xml.rels','word/numbering.xml']: print('\\n',x); print(z.read(x).decode()[:6000]) PY
    output
    word/_rels/document.xml.rels
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId8" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes" Target="endnotes.xml"/><Relationship Id="rId13" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" Target="numbering.xml"/><Relationship Id="rId7" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" Target="footnotes.xml"/><Relationship Id="rId12" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image4.png"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml" Target="../customXml/item2.xml"/><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml" Target="../customXml/item1.xml"/><Relationship Id="rId6" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings" Target="webSettings.xml"/><Relationship Id="rId11" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="media/image3.png"/><Relationship Id="rId5" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Targ
    … 6625 more characters
  7. The file contains a full formatting demo with tables, lists, links, and embedded images. I’m converting the document structure and inline styling into a self-contained HTML file so the images travel with it.

  8. cat > <tmp> <<'PY' import zipfile, xml.etree.ElementTree as ET, html, base64, re from pathlib import Path src=Path('demo.docx'); out=Path('demo.html') z=zipfile.ZipFile(src) W='http://schemas.openxmlformats.org/wordprocessingml/2006/main'; R='http://schemas.openxmlformats.org/officeDocument/2006/relationships'; A='http://schemas.openxmlformats.org/drawingml/2006/main'; ns={'w':W,'r':R,'a':A} root=ET.fromstring(z.read('word/document.xml')); body=root.find('w:body',ns) rels=ET.fromstring(z.read('word/_rels/document.xml.rels')); relmap={x.attrib['Id']:x.attrib['Target'] for x in rels} def tag(e): return e.tag.split('}')[-1] def esc(s): return html.escape(s, quote=True) def img(rid,alt=''): target=relmap.get(rid,''); data=z.read('word/'+target) if target.startswith('media/') else b'' mime='image/gif' if target.lower().endswith('.gif') else 'image/png' return '<img src=\"data:'+mime+';base64,'+base64.b64encode(data).decode()+'\" alt=\"'+esc(alt)+'\">' if data else '' def run_html(run): rp=run.find('w:rPr',ns); styles=[]; attrs='' if rp is not None: for key,css in [('b','font-weight:bold'),('i','font-style:italic'),('strike','text-decoration:line-through'),('dstrike','text-decoration:line-through'),('smallCaps','font-variant:small-caps')]: if rp.find('w:'+key,ns) is not None: styles.append(css) if rp.find('w:u',ns) is not None: styles.append('text-decoration:underline') c=rp.find('w:color',ns) if c is not None and c.get('{%s}val'%W) not in ('auto',None): styles.append('color:#'+c.get('{%s}val'%W)) h=rp.find('w:highlight',ns) if h is not None: styles.append('background-color:'+({'yellow':'#ffff00','green':'#00ff00','cyan':'#00ffff','magenta':'#ff00ff','red':'#ff0000','blue':'#0000ff'}.get(h.get('{%s}val'%W),'#ffff00'))) va=rp.find('w:vertAlign',ns) if v … 4226 more characters
    output
    created demo.html bytes 35586
    -rw-r--r--@ 1 user  staff    35K Nov  7 00:46 demo.html
  9. Created [demo.html](demo.html) with embedded images and converted document content, including tables, headings, and inline formatting.

Output

Files not kept here, for licence reasons.

CodexWith deft, skill installedPassedRead the skillUsed deft2026-11-07

Time
14s
New tokens
8.9k
Total input
58.2k
Output tokens
0.5k
Commands
3
Failed
0

Trace

  1. I’ll read the local file-conversion instructions and use the available document conversion tool to create `demo.html` in this directory.

  2. cat .agents/skills/deft/SKILL.md && rg --files -g 'demo.docx' -g 'AGENTS.md' -g 'SKILL.md'
    output
    ---
    name: deft
    description: "Use deft first for any simple, direct operation on local files, whatever the type: convert, read, extract, edit, compress, merge, split, compare or inspect. Try it before writing a script or one-liner. If unsure, run deft find; if it says no command does this, use another tool. Not for programming work: to read, write or change source code, skip it."
    ---
    
    # deft
    
    One local command for file jobs. Prefer it over writing Python or shell scripts.
    
    Syntax: `deft <group> <command> [inputs] [-o output] [--options]`
    
    Groups:
    - `pdf`: Merge, split, compress, encrypt, forms, OCR, compare, convert
    - `image`: Resize, crop, convert, compress, adjust, montage, OCR
    - `video`: Trim, merge, convert, compress, subtitles, GIF, frames (ffmpeg)
    - `audio`: Convert, trim, normalize, denoise, cut silence (ffmpeg)
    - `doc`: Word/ODT/RTF: to text, Markdown, HTML, PDF; find and replace
    - `slides`: PowerPoint: extract text, Markdown outline
    - `sheet`: Excel/CSV/ODS tables: SQL query, pivot, merge, split, convert
    - `json`: JSON: convert, format, merge, diff, validate
    - `toml`: TOML: convert, format, merge, diff, validate
    - `xml`: XML: convert, format, merge, diff, validate
    - `yaml`: YAML: convert, format, merge, diff, validate
    - `md`: Markdown to PDF, HTML, Word, EPUB; table of contents
    - `html`: HTML to Markdown, text, Word and PDF
    - `epub`: E-books: info, to text, Markdown and PDF
    - `gps`: GPX and KML tracks: convert, distance and time
    - `qr`: Create QR codes and barcodes; r
    … 710 more characters
  3. I’m using the `deft` skill for this direct file conversion. I found `demo.docx`; I’ll check the document conversion syntax and write the HTML output.

  4. deft find "convert Word docx to HTML"
    output
    doc to-html   doc -> html   Convert to a web page
    md from-docx  doc -> md     Convert to Markdown, keeping headings, lists and tables
    html to-docx  html -> docx  Convert the content to a Word document
  5. deft doc to-html demo.docx -o demo.html
    output
    ok doc.to-html demo.docx -> demo.html  30KB  0.01s
  6. Converted `demo.docx` to [demo.html](demo.html).

Output

Files not kept here, for licence reasons.

Claude Opus 5.5Without deftPassed2026-11-07

Time
27s
New tokens
14.1k
Total input
139.9k
Output tokens
2.1k
Commands
0
Failed
0

Trace

    Output

    Files not kept here, for licence reasons.

    Claude Opus 5.5With deft, skill installedPassedRead the skillUsed deft2026-11-07

    Time
    9s
    New tokens
    9.2k
    Total input
    43.5k
    Output tokens
    0.3k
    Commands
    0
    Failed
    0

    Trace

      Output

      Files not kept here, for licence reasons.

      Claude CodeWithout deftNot run yet

      Claude CodeWith deftNot run yet