-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Coy doesn't like it when a code block has its code split across multiple code
elements
#3162
Comments
Good find. Yes, that's very much non-standard use. From what I know Prism only supports I think the easiest way to fix this problem is to just use Line Highlight. We could also use Keep markup and wrap the relevant sections with |
Yeah, the HTML5 spec recommends it as implemented. I don't see a variation for multiple code elements, and Prism isn't designed assuming that's a possible code structure. |
I have a use case for this - and, and it's been working fine until I started using the copy-to-clipboard plugin. In my case, I use multiple I didn't realise that this wasn't the intended usage for Prism, and will change my usage, but I thought adding in the use case would be useful. |
Thank you for sharing this use case @drrk! I can now say with a little more certainty that we probably shouldn't allow multiple
HTTP should support highlighting the body as JSON. HTTP detect the langauge of the body by looking at the |
I have certainly used multiple |
Information:
Description
By right, Prism requires code blocks to be written as such:
Most themes are also able to accept the following:
(ie. Multiple
code
elements within apre
element. Not about which element hasclass="language-xxxx"
.)Most themes, but Coy.
Example
On Prism's website, the 'Basic Usage' (and 'Usage with CDNs') section are meant to be one code chunk, but to accommodate the custom red box (done with
<code class="highlight ...">
), the entire code chunk is split into a fewcode
elements, and Coy doesn't like that.To be clear, having multiple
code
elements within apre
element is probably not quite the right way to use Prism in the first place (correct me if I'm wrong, though), plus I can't see why anyone would put multiplecode
elements in apre
element, because the 'look' of a code block is done with thepre
element. (But maybe someone out there has a use case for it? I'd consider it an edge case, I guess.) So while this looks like a fault of Coy's, it's not exactly Coy's fault either. It just so happens that having multiplecode
elements in apre
element works well with every other theme (I think).To fix this, we should probably target the CSS on Prism's site, specifically the
pre > code.highlight
rule. I think we can use aspan
element instead to do the red box, but I'm not super sure because I haven't tried messing around with the browser's dev tools. I would try, but I need to do something else I've been putting off :P But I will probably try it later, haha.The text was updated successfully, but these errors were encountered: