英文:
Convert from markdown to docx and keeping line break using Pandoc
问题
I want to convert a markdown file to docx and keeping the linebreak using pandoc.
the markdown look like this:
I'm a test about line break
in a docx document
And when using pandoc with the argument to preserve the wrapping I get:
I’m a test about line break in a docx document
So far I tried:
pandoc test.md --wrap=preserve -o test.docx
pandoc test.md --wrap=none -o test.docx
pandoc test.md -o test.docx
None worked.
I'm using pandoc 3.1.1 on OSX 12.3
英文:
I want to convert a markdown file to docx and keeping the linebreak using pandoc.
the markdown look like this:
I'm a test about line break
in a docx document
And when using pandoc with the argument to preserve the wrapping I get:
I’m a test about line break in a docx document
So far I tried :
pandoc test.md --wrap=preserve -o test.docx
pandoc test.md --wrap=none -o test.docx
pandoc test.md -o test.docx
None worked.
I'm using pandoc 3.1.1 on OSX 12.3
答案1
得分: 1
--wrap
选项仅影响输出文件中文本的书写方式,但不影响换行符的语义意义。为此,我们需要使用另一个扩展:hard_line_breaks
:
> 扩展:hard_line_breaks
>
> 导致段落内的所有换行符被解释为硬换行符,而不是空格。
使用时需搭配 --from=markdown+hard_line_breaks
。
英文:
The --wrap
option only affects the way the text is written in the output file, but does not affect the semantic meaning of a line break. For that we need a different extension: hard_line_breaks
:
> Extension: hard_line_breaks
>
> Causes all newlines within a paragraph to be interpreted as hard line breaks instead of spaces.
Use with --from=markdown+hard_line_breaks
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论