franck-paul / hljs

Dotclear 2 plugin
GNU General Public License v2.0
0 stars 0 forks source link

Support for SyntaxeHL macros? #3

Closed julienw closed 7 months ago

julienw commented 7 months ago

Hi, The documentation says:

the ///[language_code] wiki macro is supported by HLJS for the following syntaxes if enabled in the settings.

But I don't find where to enable that in the Dotclear settings. Could you plase give some more precisions? Thanks a lot!

julienw commented 7 months ago

Actually it may be me, but for me specifying the language codes, even with hljs syntax as described in the README, doesn't work. hljs is working but only in autodetection mode.

franck-paul commented 7 months ago

Hi, The documentation says:

the ///[language_code] wiki macro is supported by HLJS for the following syntaxes if enabled in the settings.

But I don't find where to enable that in the Dotclear settings. Could you plase give some more precisions? Thanks a lot!

See menu Blog > Code highlight (or Blog > Coloration syntaxique in French)

franck-paul commented 7 months ago

Actually it may be me, but for me specifying the language codes, even with hljs syntax as described in the README, doesn't work. hljs is working but only in autodetection mode.

Wich syntax are you using and in which mode (HTML, wiki, Mardown)?

julienw commented 7 months ago

So, as you discovered in #4, I was using the wrong plugin :-)

Now I installed the good one and configured it. Using ///code <language code> or ///hljs <language code> both are recognized (I see the markup in the page). But not ///[language code] with the SyntaxeHL option, with that one [language code] is displayed as text.

For example:

///[shell]
#!/bin/sh

if grep -q XHC.*enabled /proc/acpi/wakeup ; then
  echo XHC > /proc/acpi/wakeup
fi
///

I'm using the Wiki syntax.

Here my configuration: image

Thanks!

franck-paul commented 7 months ago

Are you aware of this comment (from README.md):

As SyntaxeHL worked differently than HLJS(1), only further edition of existing posts and pages will be treated by HLJS.

1: SyntaxeHL is a PHP library and then render code in content juste before it will be saved on the server database. HLJS will only be run when the code will be displayed, in the client's browser.

?

julienw commented 7 months ago

Yes yes, I actually saved the post.

I found the issue though: I used [shell] but that isn't recognized (see https://github.com/franck-paul/hljs/blob/038650b7542acb6814d5826a594cec02bf88fc9d/src/CoreBehaviors.php#L288-L289). With [bash] this is now recognized.

So let's close this bug, this was a user problem :-)