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

Multiline comments not working #12

Closed
pianomanfrazier opened this issue Apr 18, 2019 · 6 comments
Closed

Multiline comments not working #12

pianomanfrazier opened this issue Apr 18, 2019 · 6 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@pianomanfrazier
Copy link

pianomanfrazier commented Apr 18, 2019

When I try to add a multi line comment in any c like language it doesn't render properly. I didn't add any extensions to Prism.

/*
  This is a
  Block comment
*/

screenshot

@zachleat
Copy link
Member

Is this a prism thing or do you think it's limited to this plugin?

@pianomanfrazier
Copy link
Author

I thought of that. I didn't dive into how the plugin works. I just know that I applied the plugin and multi-line comments were not working. I'm not sure how to isolate the problem to just Prism or the plugin.

My setup for Eleventy was pretty simple. You can see my .eleventy.js file at my repo here. There I have my own language extension. However, I did try it without and then tried using C code and it still didn't work.

I am injecting Typography.js onto the page but that only affects the CSS, not the Prism parsing.

I did notice though that the Prism version used in the plugin (v1.15.0) is not the latest (v1.16.0). Again, I doubt this is the issue though.

@zachleat
Copy link
Member

Not at a computer currently, can you compare with https://prismjs.com/test.html#language=javascript

What language did you pass in from your content?

@pianomanfrazier
Copy link
Author

It must be the plugin. It works on prismjs. I cloned the Eleventy Base Blog and multi line comments don't work there either.

prism_screenshot

And here is the same input on the base blog. I added the snippet to posts/firstpost.md

base_blog

@pianomanfrazier
Copy link
Author

I wonder if this is related to #9 The new line in the middle of a parsed element is throwing off the parsing.

@pianomanfrazier
Copy link
Author

pianomanfrazier commented Apr 19, 2019

It appears that the highlight line is interfering with multiline elements in the code blocks. markdownSyntaxHighlight.js

highlight-line-bad

PrismJS wraps the whole block in one span including all the line breaks.

<span class="token comment">/*
 * block comment
 * goes here
 */</span>

I imagine the output should look something like

<span class="line-comment"><span class="token comment">/*</span></span><br>
<span class="line-comment"><span class="token comment"> * block comment </span></span>
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants