Skip to content

Commit

Permalink
Merge pull request #20 from christiaanderidder/1.3.1
Browse files Browse the repository at this point in the history
Make paragraph and list item spacing configurable. Fixes #19
  • Loading branch information
christiaanderidder authored Dec 22, 2023
2 parents 8308b8b + d5ab232 commit 2e7d178
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/QuestPDF.Markdown/MarkdownRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,12 @@ private IContainer ProcessContainerBlock(ContainerBlock block, IContainer pdf)
{
pdf.Column(col =>
{
col.Spacing(10);

foreach (var item in block)
{
var container = col.Item();
if (block is ListBlock list && item is ListItemBlock listItem)
{
col.Spacing(_options.ListItemSpacing);
container.Row(li =>
{
li.Spacing(5);
Expand All @@ -91,6 +90,8 @@ private IContainer ProcessContainerBlock(ContainerBlock block, IContainer pdf)
}
else
{
// Paragraphs inside a list get the same spacing as the list items themselves
col.Spacing(item.Parent is ListItemBlock ? _options.ListItemSpacing : _options.ParagraphSpacing);
ProcessBlock(item, container);
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/QuestPDF.Markdown/MarkdownRendererOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,7 @@ public class MarkdownRendererOptions
/// The conversion factor used to scale images from pixel size to point size
/// </summary>
public float ImageScalingFactor { get; set; } = 0.5f;

public float ParagraphSpacing { get; set; } = 10;
public float ListItemSpacing { get; set; } = 10;
}

0 comments on commit 2e7d178

Please sign in to comment.