Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linebreak displays as paragraph in docx #873

Closed
PeterTrotter opened this issue Jun 4, 2013 · 1 comment
Closed

linebreak displays as paragraph in docx #873

PeterTrotter opened this issue Jun 4, 2013 · 1 comment

Comments

@PeterTrotter
Copy link

When docx documents are generated linebreaks are shown as a new paragraph (despite just being w:cr) when they should not be.

version: pandoc 1.11.1

command:

$ pandoc br-example.md -o test.docx

br-example.md:

Paragraph one line one  
Paragraph one line two

Paragraph two

I have taken snippets from the resultant document.xml for the actual/expected.

Actual:

<w:body>
    <w:p>
        <w:r>
            <w:t xml:space="preserve">Paragraph one line one</w:t>
        </w:r>
        <w:r>
            <w:cr />
        </w:r>
        <w:r>
            <w:t xml:space="preserve">Paragraph one line two</w:t>
        </w:r>
    </w:p>
    <w:p>
        <w:r>
            <w:t xml:space="preserve">Paragraph two</w:t>
        </w:r>
    </w:p>
</w:body>

Expected:

<w:body>
    <w:p>
        <w:r>
            <w:t xml:space="preserve">Paragraph one line one</w:t>
            <w:br/>
            <w:t xml:space="preserve">Paragraph one line two</w:t>
        </w:r>
    </w:p>
    <w:p>
        <w:r>
            <w:t xml:space="preserve">Paragraph two</w:t>
        </w:r>
    </w:p>
</w:body>

When rendered the actual result looks almost indistinguishable from a new paragraph and does not achieve the intended look of the linebreak which is achieved by the expected code.

I don't actually know the spec and the resultant code change shown here is based on the way LibreOffice implements linebreaks in it's docx output.

@PeterTrotter
Copy link
Author

Well, I don't know which is closer to the spec but the desired result can also be achieved by changing the <w:cr/> directly to a <w:br/>:

<w:body>
    <w:p>
        <w:r>
            <w:t xml:space="preserve">Paragraph one line one</w:t>
        </w:r>
        <w:r>
            <w:br />
        </w:r>
        <w:r>
            <w:t xml:space="preserve">Paragraph one line two</w:t>
        </w:r>
    </w:p>
    <w:p>
        <w:r>
            <w:t xml:space="preserve">Paragraph two</w:t>
        </w:r>
    </w:p>
</w:body>

@jgm jgm closed this as completed in e7b5f2d Jul 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant