From cfd6d528d95fef19ff19eaba6ef1c43e4b6a4828 Mon Sep 17 00:00:00 2001 From: Jesse Portnoy Date: Wed, 18 Dec 2024 15:09:06 +0000 Subject: [PATCH] Upgrade github.com/gomarkdown/markdown version See https://github.com/mandolyte/mdtopdf/security/dependabot/7 --- go.mod | 2 +- go.sum | 6 ++++-- nodeProcessing.go | 9 ++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 24bf4d5..0a53026 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/canhlinh/svg2png v0.0.0-20201124065332-6ba87c82371f github.com/gabriel-vasile/mimetype v1.4.2 github.com/go-pdf/fpdf v0.9.0 - github.com/gomarkdown/markdown v0.0.0-20230922105210-14b16010c2ee + github.com/gomarkdown/markdown v0.0.0-20240729212818-a2a9c4f76ef5 github.com/jessp01/gohighlight v0.21.1-7 golang.org/x/exp v0.0.0-20240707233637-46b078467d37 ) diff --git a/go.sum b/go.sum index a6c9bfe..77a78e7 100644 --- a/go.sum +++ b/go.sum @@ -7,8 +7,10 @@ github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/go-pdf/fpdf v0.9.0 h1:PPvSaUuo1iMi9KkaAn90NuKi+P4gwMedWPHhj8YlJQw= github.com/go-pdf/fpdf v0.9.0/go.mod h1:oO8N111TkmKb9D7VvWGLvLJlaZUQVPM+6V42pp3iV4Y= -github.com/gomarkdown/markdown v0.0.0-20230922105210-14b16010c2ee h1:gvsnG+uIVkOue7HrYAG2ZnOdLoJTqsLyuBFJaU0kX4M= -github.com/gomarkdown/markdown v0.0.0-20230922105210-14b16010c2ee/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= +github.com/gomarkdown/markdown v0.0.0-20240626202925-2eda941fd024 h1:saBP362Qm7zDdDXqv61kI4rzhmLFq3Z1gx34xpl6cWE= +github.com/gomarkdown/markdown v0.0.0-20240626202925-2eda941fd024/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= +github.com/gomarkdown/markdown v0.0.0-20240729212818-a2a9c4f76ef5 h1:8QWUW69MXlNdZXnDnD9vEQ1BL8/mm1FTiSesKKHYivk= +github.com/gomarkdown/markdown v0.0.0-20240729212818-a2a9c4f76ef5/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA= github.com/jessp01/gohighlight v0.21.1-7 h1:u1CurHm8ogal3AFeDMF97pDJ4aPlPdgZg5PL6ULeTb0= github.com/jessp01/gohighlight v0.21.1-7/go.mod h1:52r0Yxd1+T9f7uLenaO2/34K3gPOejxCxXwdNc/2Z8Y= github.com/mcuadros/go-version v0.0.0-20190830083331-035f6764e8d2 h1:YocNLcTBdEdvY3iDK6jfWXvEaM5OCKkjxPKoJRdB3Gg= diff --git a/nodeProcessing.go b/nodeProcessing.go index 1e8aed8..c34dd07 100644 --- a/nodeProcessing.go +++ b/nodeProcessing.go @@ -59,7 +59,13 @@ func (r *PdfRenderer) processText(node *ast.Text) { if r.cs.peek().isHeader { r.setStyler(currentStyle) // get the string width of header value - hw := r.Pdf.GetStringWidth(s) + (2 * r.em) + initialWidth := r.Pdf.GetStringWidth(s) + /* if initialWidth == 0 { + initialWidth = 30 + } + log.Println(s + ":") + log.Println(initialWidth)*/ + hw := initialWidth + (2 * r.em) // now append it cellwidths = append(cellwidths, hw) // now write it... @@ -673,6 +679,7 @@ func (r *PdfRenderer) processTableRow(node ast.Node, entering bool) { func (r *PdfRenderer) processTableCell(node ast.TableCell, entering bool) { if entering { + r.tracer("TableCell (entering)", "") x := &containerState{ textStyle: r.Normal, listkind: notlist,