Topic on Extension talk:WikiMarkdown

195.77.243.20 (talkcontribs)

I have "SyntaxHighlight" extension installed and it works fine with Wikitext, but when I edit in markdown mode like this:


```python

python code here

```


System throws this error:

[015b401c65ab6b87b21ccd91] /index.php?title=Azala Error: Class "SyntaxHighlight" not found

Backtrace:

from /home/projects/wiki/extensions/WikiMarkdown/includes/WikiMarkdown.php(102) #0 [internal function]: WikiMarkdown::{closure}()

#1 /home/projects/wiki/extensions/WikiMarkdown/includes/WikiMarkdown.php(104): preg_replace_callback()

#2 /home/projects/wiki/includes/parser/Parser.php(3996): WikiMarkdown::parserHook()

...

my LocalSettings:

# highlight

wfLoadExtension('SyntaxHighlight');

# markdown

wfLoadExtension('WikiMarkdown');

$wgAllowMarkdownExtra    = true; // allows usage of Parsedown Extra

$wgAllowMarkdownExtended = true; // allows usage of Parsedown Extended

$wgSyntaxHighlightLanguageCodeMap['markdown'] = 'markdown';

Kuenzign (talkcontribs)

What version of SyntaxHighlight do you have installed?

195.77.243.20 (talkcontribs)

SyntaxHighlight_GeSHi: REL1_40

2023-09-28T07:23:27

d0cf937

@Kuenzign

Kuenzign (talkcontribs)

It seems that on versions of SyntaxHighlight 1.39+, they put everything in a namespace. As a workaround for the time being, you can change line 102 of WikiMarkdown/includes/WikiMarkdown.php to be this instead:

return MediaWiki\SyntaxHighlight\SyntaxHighlight::parserHook( html_entity_decode( $matches[3] ), $args, $parser );
Reply to "SyntaxHighlight error"