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

top-level svg in .html include fails to render when opening tag split into multiple lines #1442

Closed
boneskull opened this issue Oct 9, 2020 · 5 comments
Labels
bug: dependency A problem in one of Eleventy’s dependencies template-language: markdown

Comments

@boneskull
Copy link

Describe the bug

When:

  • you have an included .html file, and
  • the top-level tag of the file is svg, and
  • the opening tag is spread over multiple lines, then

...the SVG fails to render in the browser.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://gist.github.com/boneskull/390aaea1c837188ae84e3a7b5ef0829e
  2. Grab include-ok.html add to 11ty site, and include it in a layout
  3. Build site; see it renders similarly to: image
  4. Replace include-ok.html with include-broken.html, build site and refresh
  5. See something broken like:
    image

You can then see the problem is fixed by trying include-ok-wrapped.html, which wraps the svg in a div tag. It doesn't even need to be wrapped; the first tag can be an empty div like <div></div> followed by <svg ..>, and it will render properly.

Screenshots

See above

Environment:

  • OS and Version: macOS 10.15.7
  • Eleventy Version: v0.11.0

Additional context

may be the fault of something else in our configuration (it's in the gist).

Ref: mochajs/mocha#4440

@binyamin
Copy link
Member

@boneskull sorry for the wait. I'll try to take a look within 24 hours.

@boneskull
Copy link
Author

no rush, it's a corner case w/ a trivial workaround.

@binyamin
Copy link
Member

Test results:

  • Breaks with markdown+liquid
  • Does not break with nunjucks
  • Does not break with just liquid
    The problem may actually be with markdown-it, which Eleventy uses under the hood. I'd open an issue there. Be sure to mention that the svg include works when wrapped in a div.

In the meantime, you could always try using a different markdown parser.

@binyamin binyamin added bug: dependency A problem in one of Eleventy’s dependencies and removed needs-triage labels Oct 19, 2020
@Ryuno-Ki
Copy link
Contributor

If you want to change the markdown parser, this section in the docs explain how to do that:
https://www.11ty.dev/docs/languages/markdown/#optional-set-your-own-library-instance
(Eleventy doesn't care, whether the set library is still markdown-it).

@zachleat
Copy link
Member

Yeah, this is a markdown-it parser bug I think! Can you file it there instead? https://github.com/markdown-it/markdown-it/issues

https://markdown-it.github.io/

broken:
image

broken:
image

working:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: dependency A problem in one of Eleventy’s dependencies template-language: markdown
Projects
None yet
Development

No branches or pull requests

4 participants