That’s a good question.
I’m guessing the plugin would need to be modified with something like this:
diff --git a/syntax-highlighting-code-block.php b/syntax-highlighting-code-block.php
index adbc897..a1acdd8 100644
--- a/syntax-highlighting-code-block.php
+++ b/syntax-highlighting-code-block.php
@@ -285,6 +285,14 @@ function render_block( $attributes, $content ) {
}
$highlighter = new \Highlight\Highlighter();
+
+ /**
+ * Fires when instantiating the highlighter.
+ *
+ * @param \Highlight\Highlighter $highlighter
+ */
+ do_action( 'syntax_highlighting_code_block_highlighter', $highlighter );
+
if ( ! empty( $auto_detect_languages ) ) {
$highlighter->setAutodetectLanguages( $auto_detect_languages );
}
And then you could have some plugin code to register the Razor Cshtml definition via something like:
add_action( 'syntax_highlighting_code_block_highlighter', function( \Highlight\Highlighter $highlighter ) {
$highlighter::registerLanguage( 'cshtml-razo', __DIR__ . '/cshtml-razo.json' );
} );
However, the highlightjs-cshtml-razor project there only has a JS file with the definition in it. The highlight.php project requires JSON language definitions.
Would you please open an issue on the GitHub repo instead? See https://github.com/westonruter/syntax-highlighting-code-block/issues