Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlighting extension not preserving whitespace in <pre> tag #20

Closed
khushmeeet opened this issue Jul 8, 2021 · 1 comment
Closed

Comments

@khushmeeet
Copy link

I am using gold mark highlighting extension in my go code like this.

highlighting.NewHighlighting(
    highlighting.WithStyle("monokai"),
),

and i define code in markdown this way

```json
{
  "site_title":"test",
  "email":"hello@flux.com",
  "twitter_username":"@test",
  "github_username":"test",
  "minify_css": true,
  "minify_html": true,
  "list": [
    "1",
    "2",
    "3"
  ],
  "map": {
    "a": 1,
    "b": 2
  }
}
```

After the rendering my formatted code block does not take whitespace or newlines into account and displays HTML like this.
Screenshot 2021-07-08 at 6 30 34 PM

Not sure, if this is a bug or I am missing some config option!

My full gold mark instantiation looks like this.

md := goldmark.New(
		goldmark.WithExtensions(meta.Meta,
			highlighting.NewHighlighting(
				highlighting.WithStyle("monokai"),
			),
			extension.Footnote,
			extension.GFM,
			emoji.Emoji,
			mathjax.MathJax,
		),
		goldmark.WithRendererOptions(
			html.WithHardWraps(),
		),
		goldmark.WithParserOptions(
			parser.WithBlockParsers(),
			parser.WithAttribute(),
		),
	)
@yuin
Copy link
Owner

yuin commented Feb 8, 2022

This seems a problem related your own CSS.

@yuin yuin closed this as completed Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants