trilbymedia / grav-plugin-prism-highlight Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Love to see support for Terraform HCL !
Solution proposed in
#14
getgrav/grav-theme-quark#202
allows one to have copy button translation working in quark theme only.
Not sure if it's possible but would be cleaner to handle copy button labels translation in grav-plugin-prism-highlight itself, without messing in every possible theme's <body>
.
The advanced usage functionality depends on the Shortcode Core plugin to function.
Maybe Shortcode Core should be made a dependency of Prism Highlight, or at least mentioned in the advanced usage section of the readme.
I added the class line-numbers to my shortcode and the line numbers do not appear.
[prism classes="language-php line-numbers" highlight="2,4"]
<?php
namespace Grav\Plugin;
use \Grav\Common\Plugin;
use \Grav\Common\Grav;
use \Grav\Common\Page\Page;
class PrismHighlightPlugin extends Plugin
{
/**
* @return array
*/
public static function getSubscribedEvents()
{
return [
'onPageInitialized' => ['onPageInitialized', 0],
'onShortcodeHandlers' => ['onShortcodeHandlers', 0],
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],
];
}
}
[/prism]
enabled: true
theme: prism-base16-ocean.dark.css
all-pre-blocks: true
plugins:
line-numbers: true
command-line: false
command-line-prompt: '$'
Not sure if this is a right repo to fill this issue, but I think this Grav plugin should allow disabling bundled Prism.js plugins.
Why this is needed? Sometimes Grav themes bundle their own native features which overlaps with Prism.js functionality. For example learn2-git-sync theme have its own Copy to clipboard button, but it also uses prism-highlight
for highlighting itself. This results in all <pre>
and <code>
tags having duplicate Copy to clipboard buttons on top of each other.
I know that there is a custom js option, but having ability to just disable Prism.js plugins would be much cleaner, without a need to keep a custom library version in sync with what this plugin provides.
plugin installed,
I write
[prism classes="language-html line-numbers"]
<!DOCTYPE html>
<html>
<head>
<title>......................</title>
</head>
<body>
.............................................................
</body>
</html>
[/prism]
and see this:
TypeError
Argument 1 passed to DOMNode::replaceChild() must be an instance of DOMNode, null given
where my error?
First off, love this plugin. For me though, it would be pretty useful to have powershell support.
The highlight plugin doesn't have it either. Very much a bummer, because most markdown engines support it, including GitHub.
Prism.js supports it, and getting the code from their site, I managed to get some powershell highlighting going, but then the integration with your plugin is broken, because I'm basically using "vanilla" prism.js. (Or perhaps the integration breaks in a different way, I'm not sure).
I can't deal with minified js files. Is it possible that you share the non-minified js? (If you did in fact modify it).
Alternatively, just having a version that supports all languages that Prism.js supports would be nice. (Or just powershell ;) )
If adding extra languages is somehow very complex/time consuming, then I beg your pardon, I have no idea what you have to do to get it working in/with Grav.
Wrong links to GitHub in plugin blueprints. Missing -plugin
leads to 404
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.