goldmark-pdf icon indicating copy to clipboard operation
goldmark-pdf copied to clipboard

Rendering quotes

Open idroz opened this issue 1 year ago • 2 comments

Thanks for a great package. Is there a way to customise the renderer to parse quotes correctly.

Consider source:

source := `"Just a test"`
markdown := goldmark.New(
		goldmark.WithRenderer(
		pdf.New(
				pdf.WithHeadingFont(pdf.GetTextFont("Times", pdf.FontTimes)),
				pdf.WithBodyFont(pdf.GetTextFont("Times", pdf.FontTimes)),
		)),
	
	)

var buf bytes.Buffer
if err := markdown.Convert([]byte(source), &buf); err != nil {
return err
}

buf.Bytes()

Will produce:

"Just a test"

The desired output is "Just a test"

I presume this has to do with passing correct options to WithNodeRenderers(), but struggling to see what those are from the source code.

Thanks for the help!

idroz avatar Feb 16 '23 12:02 idroz

I suspect this has something to do with encoding HTML entities. Maybe because of some copied code from the HTML renderer. I'll take a look.

stephenafamo avatar Feb 21 '23 08:02 stephenafamo

A similar "issue" was present in the default gold mark html renderer and I managed to solve it by passing html.WithXHTML() to goldmark.WithRendererOptions.

idroz avatar Feb 21 '23 08:02 idroz