Closed ifdattic closed 10 years ago
Same here!
When using WebPlatform Docs plugin you can no longer use language-css
as @ifdattic stated. You have to use language-scss
when targeting css
code blocks.
I had to tweak the plugin in a lame (and hardcoded) way to add support for scss
code blocks, like so:
if (env.language == 'css' || env.language == 'scss')
But this doesn't change the fact that there's something there throwing an error when using css
code blocks.
Cheers.
Do you have a test case? I currently can't reproduce the issue.
Actually I don't. All I did was download Prism and then start adding plugins to it until I found WebPlatform was the one.
Do you want me to set up an example and share it with you?
Would be nice. I tried it with this code and didn't get an error:
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Prism Test</title>
<link rel="stylesheet" href="/_Github/LeaVerou/prism/themes/prism.css" />
<link rel="stylesheet" href="/_Github/LeaVerou/prism/plugins/wpd/prism-wpd.css" />
</head>
<body>
<pre><code class="language-css"><?= file_get_contents("content.css") ?></code></pre>
<script src="/_Github/LeaVerou/prism/components/prism-core.js"></script>
<script src="/_Github/LeaVerou/prism/components/prism-css.js"></script>
<script src="/_Github/LeaVerou/prism/plugins/wpd/prism-wpd.min.js"></script>
</body>
</html>
(installed version: cc36c8567d7aa216114f4215c1e8c361a8420c79)
I'll try make an example when I get home, right now I'm at work :P But let me tell you that I used the compiled JS you get from http://prismjs.com/download.html (Development version, Languages: All, Pugins: Autolinker, WebPlatform and File highlighter)
Aha! I can reproduce it now.
Ok, found the issue.
The wpd-plugin assumes, that Prism.languages.css.selector
is just a regex, but if you load css-extras
it is not just a regex anymore.
Patch should be trivial.
Do you think you can fix it and submit a pull request @apfelbox ?
@hiulit done. @LeaVerou could you take a look and merge it, if everything is all right?
Done! Closing this issue, feel free to reopen if the issue persists. Thanks again @apfelbox!
While working with Prism I noticed it throws a JS error. After a bit of tinkering here is what I have:
CSS
code blocks. HTML works, and even SCSS works (just with wrong links).Hope this helps.