inokawa / remark-docx

remark plugin to compile markdown to docx (Microsoft Word, Office Open XML).
https://inokawa.github.io/remark-docx/
MIT License
42 stars 15 forks source link

Paragraph margin bottom #42

Closed flogy closed 1 year ago

flogy commented 1 year ago

First of all, thank you very much, @inokawa for this awesome library!

Is your feature request related to a problem? Please describe. Yes, I've tried the demo which worked very nicely. However, it seems that there currently is no option to add some space between paragraphs.

Describe the solution you'd like A styling option for the whole document to apply e.g. 20px of space below every paragraph.

Describe alternatives you've considered I've tried to add markdown Break and ThematicBreak but it is not the ideal solution.

Possible solution It might be possible to add the spacing parameter (after) here like described in this documentation, and set it to a configurable value.

I unfortunately can't implement it myself currently due to lack of time but if this is still open later I'd give it a try.

flogy commented 1 year ago

Was able to solve this by using the docx styling option:

const markdownProcessor = unified()
        .use(remarkParse)
        .use(remarkDocx, {
          output: 'buffer',
          styles: {
            default: {
              document: {
                paragraph: {
                  spacing: {
                    before: 240,
                    after: 120,
                  },
                },
              },
              listParagraph: {
                paragraph: {
                  spacing: {
                    before: 0,
                    after: 0,
                  },
                },
              },
            },
          },
        });