Skip to content

[Bug]: HWPX → TXT/MD drops line breaks inside a paragraph (Unhwp ignores <hp:lineBreak/>) #1416

Closed

Description

@yavuzmeteafsar

What happened?

When a paragraph has line breaks (<hp:lineBreak/>), HWPX → TXT and HWPX → MD put the whole paragraph on one line. The text, the indentation and the empty lines are there in the HWPX but come out joined:

import java.io.BufferedReader;class FileTask implements Runnable {    private String fileName;    public void run() {        int count = 0; …

The HWPX itself is right. This one came from RTF → HWPX (Pandoc reads the RTF's line breaks as LineBreak, and the HWPX writer turns them into <hp:lineBreak/>), and its section0.xml has one paragraph with 13 of them:

<hp:t>import java.io.BufferedReader;<hp:lineBreak/><hp:lineBreak/>class FileTask implements Runnable {<hp:lineBreak/>    private String fileName;<hp:lineBreak/> …

The line breaks get lost in Unhwp: UnhwpConverter takes the text from document.ToText() (TXT) and Unhwp's Markdown (MD), and both drop <hp:lineBreak/>. The same file through Unhwp's Python package gives the same one line from extract_text and to_markdown, both in 0.13.0 (the version Filee uses) and in the latest 0.23.1.

Found while working on #1204 / #1388, where it was the reason RTF → TXT couldn't go through the HWPX route.

Any HWP/HWPX file with line breaks inside a paragraph is affected, not only files made from RTF.

What did you expect?

Each hp:lineBreak/ becomes a line break in the text (in Markdown, a hard break), so lines, indentation and empty lines stay as they are.

Steps to reproduce

  1. filee convert sample.rtf --to hwpx (the attached RTF; any RTF with several lines in one paragraph, e.g. code from TextEdit, works).
  2. Check Contents/section0.xml inside the HWPX: the <hp:lineBreak/> elements are there.
  3. filee convert sample.hwpx --to txt (or --to md): everything is on one line.

Without Filee, the same with Unhwp's Python package (0.23.1):

python3 -c "import unhwp; print(repr(unhwp.extract_text('sample.hwpx')))"

Files involved

sample.rtf (the RTF) and sample.hwpx (what Filee writes from it), both attached.

lineBreak-sample.zip

Filee version

main (47e24cd), also 2.3.0

Operating system

macOS 27.0.1

Engines page status

Built-in Unhwp; Pandoc found on this Mac (Homebrew), needed only for the RTF → HWPX step.

Log


Activity

  1. added a commit that references this issue on Nov 12, 2026
    320da70
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions