christiaanderidder / QuestPDF.Markdown

QuestPDF.Markdown allows rendering markdown into a QuestPDF document
MIT License
29 stars 7 forks source link

Spacing between list items is too big #19

Closed AppiePau closed 10 months ago

AppiePau commented 10 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior: Using the following code, I get an unordered list with a lot of white space between the lines. Using the debugger it seems that every bullet point is placed in it's own paragraph.

+ Test
+ Test
+ Test

or a full example:

var document = Document.Create(container =>
    {
        container.Page(page =>
        {
            page.Size(PageSizes.A4);
            page.Margin(1, Unit.Centimetre);
            page.PageColor(Colors.White);
            page.DefaultTextStyle(x => x.FontSize(10));

            page.Content().Row(row =>
            {

                row.RelativeItem(1)
                    .Markdown("Test line above list.\r\n* Test\r\n* Test\r\n* Test");
            });
        });
    });

document.GeneratePdfAndShow();

Expected behavior I would like to see the bullet points in one paragraph and each bullet point on a new line, resulting each line without the white space. Wether this is default behavior or configurable is less of a concern to me. It just seems more logical for me to have items of the same list without whitespace. Just like in HTML <ul> with <li> behavior. Like:

Screenshots

Screenshot 2023-12-20 at 21 10 53

Note: Only the Test bullets are part of the Markdown code. The rest of layout/texts are not. I can reproduce this behavior in various places.

Screenshot 2023-12-20 at 16 45 44

Environment (please complete the following information):

Additional context No comments at this moment.

christiaanderidder commented 10 months ago

Thanks for submitting this issue. The nested paragraphs seem to be a limitation of how markdig renders the markdown document, but it should be no issue to make the spacings within lists configurable. This should address your issue.