highlight.js for SMF

Started by Bugo, August 28, 2011, 01:18:09 PM

Previous topic - Next topic

alexetgus

The mod is a fork of https://highlightjs.org/.
The Github repository is https://github.com/isagalaev/highlight.js

Thanks, Bugo, for your working ! ;)

alexetgus

French translation
Traduction française.

French
<?php

/**
 * .french.php
 *
 * @package Code Highlighting
 * @author Bugo https://dragomano.ru/mods/code-highlighting
 * @French translation by Alex - https://chez-oim.org
 *
 */

$txt['ch_title']    = 'Coloration de la syntaxe';
$txt['ch_settings'] = 'Param&egrave;tres de la coloration';
$txt['ch_desc']     = 'Ici, vous pouvez activer/d&eacute;sactiver la mise en surbrillance, choisir le th&egrave;me de style pr&eacute;f&eacute;r&eacute;, etc.';
$txt['ch_enable']   = 'Activer la coloration syntaxique';
$txt['ch_cdn_use']  = 'Utiliser un CDN pour charger les scripts et styles';
$txt['ch_style']    = 'Style de la coloration syntaxique';
$txt['ch_tab']      = 'Nombre de d\'espaces pour les tabulations (indentation)';
$txt['ch_fontsize'] = 'Taille des caract&egrave;res';
$txt['ch_example']  = 'Exemple';
$txt['ch_copy']     = 'Copier';



French-utf8
(ATTENTION ! Copie non recommandée, téléchargez le fichier ci dessous. C'est plus prudent.
WARNING ! Copy not recommended, download the file below. It's more careful.)
<?php

/**
 * .french-utf8.php
 *
 * @package Code Highlighting
 * @author Bugo https://dragomano.ru/mods/code-highlighting
 * @French translation by Alex - https://chez-oim.org
 *
 */

$txt['ch_title']    = 'Coloration de la syntaxe';
$txt['ch_settings'] = 'Paramètres de la coloration';
$txt['ch_desc']     = 'Ici, vous pouvez activer/désactiver la mise en surbrillance, choisir le thème de style préféré, etc.';
$txt['ch_enable']   = 'Activer la coloration syntaxique';
$txt['ch_cdn_use']  = 'Utiliser un CDN pour charger les scripts et styles';
$txt['ch_style']    = 'Style de la coloration syntaxique';
$txt['ch_tab']      = 'Nombre d\'espaces pour les tabulations (indentation)';
$txt['ch_fontsize'] = 'Taille des caractères';
$txt['ch_example']  = 'Exemple';
$txt['ch_copy']     = 'Copier';



Stoquer les fichiers dans le dossier /Themes/default/languages/Highlight
Stock the files in the directory /Themes/default/languages/Highlight
.french.php
.french-utf8.php



-Rock Lee-

I leave the translation attached to the normal Latin Spanish and utf-8, they should put it inside the folder ../Themes/default/languages/Highlight/


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

Bugo

Thanks. The mod has updated.

alexetgus


Parmaster

Hi Bugo!

Can you help me to integrate your mod into the knwoledge base mod https://custom.simplemachines.org/mods/index.php?mod=3185 ?

In my forum your mod works perfectly, but I would like to have the highlighting inside the kb mod too, if it's possible.

Bugo

Open Sources/Subs-Highlight.php, find

$hl = preg_match('/topic|msg|action=post|action=recent|action=unreadreplies|action=admin/i', $_SERVER['REQUEST_URI']) ? true : false;

and replace with

$hl = preg_match('/topic|msg|action=post|action=recent|action=unreadreplies|action=admin|action=kb/i', $_SERVER['REQUEST_URI']) ? true : false;

Parmaster

Thank you!

That helped me alot!

Erikson

Dear Bugo.

Big Problem. Hope you can help me?! Version 1.2 does not work anymore. But has worked wonderfully before. Now I have made an update to Version 1.3. Does not work too. I can not find a mistake . ??? ::).

Erikson
The best Forum Software? - SMF ./. The Best Support? - SMF-Support

Bugo

What is your SMF version?
Please, make a screenshot of your settings.

Erikson

Dear Bugo ;)

SMF Version:  - 2.0.15

Screenshot of Settings:



Notice! - * - You see the Black and White... ??? ::)

Erikson ???
The best Forum Software? - SMF ./. The Best Support? - SMF-Support

Bugo

Check these paths:
/Themes/default/scripts/highlight.pack.js
/Themes/default/css/highlight.css
/Themes/default/css/highlight dir

Make sure they exist and not empty.

Erikson

Dear Bugo,

I checked. Everything okay.

Quote from: Bugo on September 02, 2018, 04:03:14 AM
Check these paths:
/Themes/default/scripts/highlight.pack.js
/Themes/default/css/highlight.css
/Themes/default/css/highlight dir

Make sure they exist and not empty.

Erikson
The best Forum Software? - SMF ./. The Best Support? - SMF-Support

Bugo

Well, send me via PM or post here a link to any example message with code on your forum.

Erikson

Dear Bugo.

PM was send! ;)

Quote from: Bugo on September 03, 2018, 01:18:07 AM
Well, send me via PM or post here a link to any example message with code on your forum.

Erikson
The best Forum Software? - SMF ./. The Best Support? - SMF-Support

SilverKnight

Hi,

This is great, i appreciate your work. However there is a bug where if you include the cdn, the format you choose is not displayed, not including the cdn option will show the style.

I also request you add a line number system to the far left, so you can clearly see the code per line and maybe a "preview" option to show without lines that you can toggle.

Bugo

Quote from: SilverKnight on January 15, 2021, 11:40:59 PM
However there is a bug where if you include the cdn, the format you choose is not displayed, not including the cdn option will show the style.
Can you provide a screenshot of this bug?

SilverKnight

Quote from: Bugo on January 16, 2021, 12:39:06 AM
Quote from: SilverKnight on January 15, 2021, 11:40:59 PM
However there is a bug where if you include the cdn, the format you choose is not displayed, not including the cdn option will show the style.
Can you provide a screenshot of this bug?

If "Use CDN service to load highlight scripts and styles is ticked, then it shows basic style":

https://i.imgur.com/lnjuIg5.png

Also , i presume the example in the options should show how the style will look like however is simply stays white regardless of cdn option, as shown:

https://i.imgur.com/BboInWW.png

Regardless of cdn, if you edit a message and preview the post, it will show the correct format aka this:

https://i.imgur.com/sVFni8q.png

Hope this helps.

Bugo

Well, about your request to display line numbering - I will try to add this as a feature. However, read the opinion of the highlight script developer.

As for your problem - the script does not load all languages, but only the selected ones. You should go on https://highlightjs.org/download/ and select desired languages, then upload highligh.pack.js into your /Themes/default/scripts dir. Then disable "Use CDN service..." option.


gevv

Hi,

Smf 2.1 does not scroll right, left mobile

Is there a solution to the problem?
ElkArte is a modern, powerful community building forum software. https://www.elkarte.net/

Advertisement: