Skip to content
Extraits de code Groupes Projets
Valider 2a2b5706 rédigé par bricebou's avatar bricebou
Parcourir les fichiers

feat: mise en place d'une barre d'outil pour Markdown

parent c659706a
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
<?php
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
include_spip('inc/config');
function barre_outils_md_edition() {
$hmini = lire_config('markdown/hmini' ?? 1);
$subheaders_buttons = [];
for ($i = $hmini + 1; $i < $hmini + 3; $i++) {
$subheaders_buttons[] = [
'id' => 'header_' . $i,
'name' => _T('barreoutils:barre_md_header_' . $i),
'className' => 'outil_header_' . $i,
'openWith' => str_repeat('#', $i) . ' ',
'display' => true,
'selectionType' => 'line',
'key' => $i,
];
}
$set = new Barre_outils([
'nameSpace' => 'md_edition',
// On reprend la config de la barre d'édition du Porte-Plume
#'previewAutoRefresh'=> true,
#'previewParserPath' => url_absolue(generer_url_public('preview')),
'onShiftEnter' => ['keepDefault' => false, 'replaceWith' => "\n_ "],
'onCtrlEnter' => ['keepDefault' => false, 'replaceWith' => "\n\n"],
// garder les listes si on appuie sur entree
'onEnter' => ['keepDefault' => false, 'selectionType' => 'return', 'replaceWith' => "\n"],
// Utile quand on saisi du code, mais pas accessible !
#'onTab' => array('keepDefault'=>false, 'replaceWith'=>"\t"),
'markupSet' => [
// headers - # ~ #####
[
'id' => 'headers',
'name' => _T('barreoutils:barre_md_header_' . $hmini),
'className' => 'outil_header_' . $hmini,
'key' => $hmini,
'openWith' => str_repeat('#', $hmini) . ' ',
'display' => true,
'selectionType' => 'line',
'dropMenu' => $subheaders_buttons,
],
// Bold - **
[
'id' => 'bold',
'name' => _T('barreoutils:barre_md_gras'),
'key' => 'B',
'className' => 'outil_bold',
'openWith' => '**',
'closeWith' => '**',
'display' => true,
'selectionType' => 'word',
],
// Italic - *
[
'id' => 'italic',
'name' => _T('barreoutils:barre_md_italique'),
'key' => 'I',
'className' => 'outil_italic',
'openWith' => '*',
'closeWith' => '*',
'display' => true,
'selectionType' => 'word',
],
// listes (- )
[
'id' => 'liste_ul',
'name' => _T('barreoutils:barre_liste_ul'),
'className' => 'outil_liste_ul',
'replaceWith' => 'function(h){ return outil_liste_markdown(h, "-");}',
'display' => true,
'selectionType' => 'line',
'forceMultiline' => true,
'dropMenu' => [
// liste (1. )
[
'id' => 'liste_ol',
'name' => _T('barreoutils:barre_liste_ol'),
'className' => 'outil_liste_ol',
'replaceWith' => 'function(h){ return outil_liste_markdown(h, "1.");}',
'openWith' => '1. ',
'display' => true,
'selectionType' => 'line',
'forceMultiline' => true,
],
// desindenter
[
'id' => 'desindenter',
'name' => _T('barreoutils:barre_desindenter'),
'className' => 'outil_desindenter',
'replaceWith' => 'function(h){return outil_md_desindenter(h);}',
'display' => true,
'selectionType' => 'line',
'forceMultiline' => true,
],
// indenter
[
'id' => 'indenter',
'name' => _T('barreoutils:barre_indenter'),
'className' => 'outil_indenter',
'replaceWith' => 'function(h){return outil_md_indenter(h);}',
'display' => true,
'selectionType' => 'line',
'forceMultiline' => true,
],
],
],
// lien markdown
[
'id' => 'link',
'name' => _T('barreoutils:barre_md_lien'),
'key' => 'L',
'className' => 'outil_link',
'openWith' => '[',
'closeWith' => ']([![' . _T('barreoutils:barre_lien_input') . ']!])',
'display' => true,
],
// note en bas de page spip
[
'id' => 'notes',
'name' => _T('barreoutils:barre_note'),
'className' => 'outil_notes',
'openWith' => '[[',
'closeWith' => ']]',
'display' => true,
'selectionType' => 'word',
],
// blockquote
[
'id' => 'quote',
'name' => _T('barreoutils:barre_quote'),
'key' => 'Q',
'className' => 'outil_quote',
'openWith' => "\n> ",
'display' => true,
'selectionType' => 'word',
],
// guillemets
[
'id' => 'guillemets',
'name' => _T('barreoutils:barre_guillemets'),
'className' => 'outil_guillemets',
'openWith' => '&laquo;',
'closeWith' => '&raquo;',
'display' => true,
'lang' => ['fr', 'eo', 'cpf', 'ar', 'es'],
'selectionType' => 'word',
'dropMenu' => [
// guillemets internes
[
'id' => 'guillemets_simples',
'name' => _T('barreoutils:barre_guillemets_simples'),
'className' => 'outil_guillemets_simples',
'openWith' => '&ldquo;',
'closeWith' => '&rdquo;',
'display' => true,
'lang' => ['fr', 'eo', 'cpf', 'ar', 'es'],
'selectionType' => 'word',
],
]
],
// guillemets de
[
'id' => 'guillemets_de',
'name' => _T('barreoutils:barre_guillemets'),
'className' => 'outil_guillemets_de',
'openWith' => '&bdquo;',
'closeWith' => '&ldquo;',
'display' => true,
'lang' => ['bg', 'de', 'pl', 'hr', 'src'],
'selectionType' => 'word',
'dropMenu' => [
// guillemets de, simples
[
'id' => 'guillemets_de_simples',
'name' => _T('barreoutils:barre_guillemets_simples'),
'className' => 'outil_guillemets_de_simples',
'openWith' => '&sbquo;',
'closeWith' => '&lsquo;',
'display' => true,
'lang' => ['bg', 'de', 'pl', 'hr', 'src'],
'selectionType' => 'word',
],
]
],
// guillemets autres langues
[
'id' => 'guillemets_autres',
'name' => _T('barreoutils:barre_guillemets'),
'className' => 'outil_guillemets_simples',
'openWith' => '&ldquo;',
'closeWith' => '&rdquo;',
'display' => true,
'lang_not' => ['fr', 'eo', 'cpf', 'ar', 'es', 'bg', 'de', 'pl', 'hr', 'src'],
'selectionType' => 'word',
'dropMenu' => [
// guillemets simples, autres langues
[
'id' => 'guillemets_autres_simples',
'name' => _T('barreoutils:barre_guillemets_simples'),
'className' => 'outil_guillemets_uniques',
'openWith' => '&lsquo;',
'closeWith' => '&rsquo;',
'display' => true,
'lang_not' => ['fr', 'eo', 'cpf', 'ar', 'es', 'bg', 'de', 'pl', 'hr', 'src'],
'selectionType' => 'word',
],
]
],
[
'id' => 'grpCaracteres',
'name' => _T('barreoutils:barre_inserer_caracteres'),
'className' => 'outil_caracteres',
'display' => true,
'dropMenu' => [
// A majuscule accent grave
[
'id' => 'A_grave',
'name' => _T('barreoutils:barre_a_accent_grave'),
'className' => 'outil_a_maj_grave',
'replaceWith' => '&Agrave;',
'display' => true,
'lang' => ['fr', 'eo', 'cpf'],
],
// E majuscule accent aigu
[
'id' => 'E_aigu',
'name' => _T('barreoutils:barre_e_accent_aigu'),
'className' => 'outil_e_maj_aigu',
'replaceWith' => '&Eacute;',
'display' => true,
'lang' => ['fr', 'eo', 'cpf'],
],
// E majuscule accent grave
[
'id' => 'E_grave',
'name' => _T('barreoutils:barre_e_accent_grave'),
'className' => 'outil_e_maj_grave',
'replaceWith' => '&Egrave;',
'display' => true,
'lang' => ['fr', 'eo', 'cpf'],
],
// e dans le a
[
'id' => 'aelig',
'name' => _T('barreoutils:barre_ea'),
'className' => 'outil_aelig',
'replaceWith' => '&aelig;',
'display' => true,
'lang' => ['fr', 'eo', 'cpf'],
],
// e dans le a majuscule
[
'id' => 'AElig',
'name' => _T('barreoutils:barre_ea_maj'),
'className' => 'outil_aelig_maj',
'replaceWith' => '&AElig;',
'display' => true,
'lang' => ['fr', 'eo', 'cpf'],
],
// oe
[
'id' => 'oe',
'name' => _T('barreoutils:barre_eo'),
'className' => 'outil_oe',
'replaceWith' => '&oelig;',
'display' => true,
'lang' => ['fr'],
],
// OE
[
'id' => 'OE',
'name' => _T('barreoutils:barre_eo_maj'),
'className' => 'outil_oe_maj',
'replaceWith' => '&OElig;',
'display' => true,
'lang' => ['fr'],
],
// c cedille majuscule
[
'id' => 'Ccedil',
'name' => _T('barreoutils:barre_c_cedille_maj'),
'className' => 'outil_ccedil_maj',
'replaceWith' => '&Ccedil;',
'display' => true,
'lang' => ['fr', 'eo', 'cpf'],
],
// Transformation en majuscule
[
'id' => 'uppercase',
'name' => _T('barreoutils:barre_gestion_cr_changercassemajuscules'),
'className' => 'outil_uppercase',
'replaceWith' => 'function(markitup) { return markitup.selection.toUpperCase() }',
'display' => true,
'lang' => ['fr', 'en'],
],
// Transformation en minuscule
[
'id' => 'lowercase',
'name' => _T('barreoutils:barre_gestion_cr_changercasseminuscules'),
'className' => 'outil_lowercase',
'replaceWith' => 'function(markitup) { return markitup.selection.toLowerCase() }',
'display' => true,
'lang' => ['fr', 'en'],
],
],
],
[
// groupe code et bouton <code>
'id' => 'grpCode',
'name' => _T('barreoutils:barre_inserer_code'),
'className' => 'outil_code',
'openWith' => '`',
'closeWith' => '`',
'display' => true,
'dropMenu' => [
// bouton <cadre>
[
'id' => 'cadre',
'name' => _T('barreoutils:barre_inserer_cadre'),
'className' => 'outil_cadre',
'openWith' => "\n```\n",
'closeWith' => "\n```\n",
'display' => true,
],
],
],
],
'functions' => "
function outil_liste_markdown(h, c) {
if ((s = h.selection) && (r = s.match(/^(( *)-) (.*)\$/))) {
s = r[3];
} else {
s = c + ' ' + s;
}
return s;
}
function outil_md_desindenter(h) {
space = ' ';
if ((s = h.selection) && (r = s.match(/^(( *)(-)) (.*)\$/))) {
if (r[2].length >= 4 && r[2].length % 4 == 0) {
s = space.repeat(r[2].length - 4) + r[3] + ' ' + r[4];
}
}
return s;
}
function outil_md_indenter(h) {
space = ' ';
if ((s = h.selection) && (r = s.match(/^(( *)(-)) (.*)\$/))) {
if (r[2].length % 4 == 0) {
s = space.repeat(r[2].length + 4) + r[3] + ' ' + r[4];
}
}
return s;
}
",
]);
return $set;
}
/**
* Définitions des liens entre css et icones
*
* @return array
* Couples identifiant de bouton => nom de l'image (ou tableau nom, position haut, position bas)
*/
function barre_outils_md_edition_icones() {
return [
'outil_header_1' => 'h1.svg',
'outil_header_2' => 'h2.svg',
'outil_header_3' => 'h3.svg',
'outil_header_4' => 'h4.svg',
'outil_header_5' => 'h5.svg',
'outil_header_6' => 'h6.svg',
];
}
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 0 4.2333332 4.2333335"
height="16"
width="16"
version="1.1"
id="svg4"
sodipodi:docname="h1.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="712"
id="namedview6"
showgrid="false"
inkscape:zoom="16"
inkscape:cx="9.3285693"
inkscape:cy="7.8055734"
inkscape:window-x="1920"
inkscape:window-y="111"
inkscape:window-maximized="1"
inkscape:current-layer="g869"
showguides="true"
inkscape:guide-bbox="true" />
<g
id="g869"
transform="translate(-2.6905974,0.16366866)">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.01596px;line-height:1.25;font-family:Jetb;-inkscape-font-specification:Jetb;fill:#595959;fill-opacity:1;stroke:none;stroke-width:0.1004"
x="3.1434689"
y="3.4240587"
id="text933"
transform="scale(0.89986532,1.1112774)"><tspan
sodipodi:role="line"
x="3.1434689"
y="3.4240587"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'JetBrains Mono';-inkscape-font-specification:'JetBrains Mono';fill:#595959;fill-opacity:1;stroke-width:0.1004"
id="tspan947"></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.94497px;line-height:1.25;font-family:sans-serif;fill:#595959;fill-opacity:1;stroke:none;stroke-width:0.123624"
x="5.4725542"
y="4.2744703"
id="text943"><tspan
sodipodi:role="line"
id="tspan941"
x="5.4725542"
y="4.2744703"
style="fill:#595959;fill-opacity:1;stroke-width:0.123624" /></text>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 0 4.2333332 4.2333335"
height="16"
width="16"
version="1.1"
id="svg4"
sodipodi:docname="h2.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="712"
id="namedview6"
showgrid="false"
inkscape:zoom="16"
inkscape:cx="9.3285693"
inkscape:cy="14.591054"
inkscape:window-x="1920"
inkscape:window-y="111"
inkscape:window-maximized="1"
inkscape:current-layer="g869"
showguides="true"
inkscape:guide-bbox="true" />
<g
id="g869"
transform="translate(-2.6905974,0.16366866)">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.00176px;line-height:1.25;font-family:Jetb;-inkscape-font-specification:Jetb;fill:#595959;fill-opacity:1;stroke:none;stroke-width:0.100045"
x="3.1163895"
y="3.4125612"
id="text933"
transform="scale(0.90748558,1.1019459)"><tspan
sodipodi:role="line"
x="3.1163895"
y="3.4125612"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'JetBrains Mono';-inkscape-font-specification:'JetBrains Mono';fill:#595959;fill-opacity:1;stroke-width:0.100045"
id="tspan951"></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.94497px;line-height:1.25;font-family:sans-serif;fill:#595959;fill-opacity:1;stroke:none;stroke-width:0.123624"
x="5.4725542"
y="4.2744703"
id="text943"><tspan
sodipodi:role="line"
id="tspan941"
x="5.4725542"
y="4.2744703"
style="fill:#595959;fill-opacity:1;stroke-width:0.123624" /></text>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 0 4.2333332 4.2333335"
height="16"
width="16"
version="1.1"
id="svg4"
sodipodi:docname="h3.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="712"
id="namedview6"
showgrid="false"
inkscape:zoom="16"
inkscape:cx="9.3285693"
inkscape:cy="14.591054"
inkscape:window-x="1920"
inkscape:window-y="111"
inkscape:window-maximized="1"
inkscape:current-layer="g869"
showguides="true"
inkscape:guide-bbox="true" />
<g
id="g869"
transform="translate(-2.6905974,0.16366866)">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.06952px;line-height:1.25;font-family:Jetb;-inkscape-font-specification:Jetb;fill:#595959;fill-opacity:1;stroke:none;stroke-width:0.101738"
x="3.0944738"
y="3.4739015"
id="text933"
transform="scale(0.91296354,1.095334)"><tspan
sodipodi:role="line"
x="3.0944738"
y="3.4739015"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'JetBrains Mono';-inkscape-font-specification:'JetBrains Mono';fill:#595959;fill-opacity:1;stroke-width:0.101738"
id="tspan951"></tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.94497px;line-height:1.25;font-family:sans-serif;fill:#595959;fill-opacity:1;stroke:none;stroke-width:0.123624"
x="5.4725542"
y="4.2744703"
id="text943"><tspan
sodipodi:role="line"
id="tspan941"
x="5.4725542"
y="4.2744703"
style="fill:#595959;fill-opacity:1;stroke-width:0.123624" /></text>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 0 4.2333332 4.2333335"
height="16"
width="16"
version="1.1"
id="svg4"
sodipodi:docname="h4.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="712"
id="namedview6"
showgrid="false"
inkscape:zoom="16"
inkscape:cx="9.3285693"
inkscape:cy="14.591054"
inkscape:window-x="1920"
inkscape:window-y="111"
inkscape:window-maximized="1"
inkscape:current-layer="g869"
showguides="true"
inkscape:guide-bbox="true" />
<g
id="g869"
transform="translate(-2.6905974,0.16366866)">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.07771px;line-height:1.25;font-family:Jetb;-inkscape-font-specification:Jetb;fill:#595959;fill-opacity:1;stroke:none;stroke-width:0.101943"
x="3.0876901"
y="3.480891"
id="text933"
transform="scale(0.91479985,1.0931353)"><tspan
sodipodi:role="line"
x="3.0876901"
y="3.480891"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'JetBrains Mono';-inkscape-font-specification:'JetBrains Mono';fill:#595959;fill-opacity:1;stroke-width:0.101943"
id="tspan951">#⁴</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.94497px;line-height:1.25;font-family:sans-serif;fill:#595959;fill-opacity:1;stroke:none;stroke-width:0.123624"
x="5.4725542"
y="4.2744703"
id="text943"><tspan
sodipodi:role="line"
id="tspan941"
x="5.4725542"
y="4.2744703"
style="fill:#595959;fill-opacity:1;stroke-width:0.123624" /></text>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 0 4.2333332 4.2333335"
height="16"
width="16"
version="1.1"
id="svg4"
sodipodi:docname="h5.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="712"
id="namedview6"
showgrid="false"
inkscape:zoom="16"
inkscape:cx="9.3285693"
inkscape:cy="14.591054"
inkscape:window-x="1920"
inkscape:window-y="111"
inkscape:window-maximized="1"
inkscape:current-layer="g869"
showguides="true"
inkscape:guide-bbox="true" />
<g
id="g869"
transform="translate(-2.6905974,0.16366866)">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.06585px;line-height:1.25;font-family:Jetb;-inkscape-font-specification:Jetb;fill:#595959;fill-opacity:1;stroke:none;stroke-width:0.101647"
x="3.101428"
y="3.4665947"
id="text933"
transform="scale(0.91104394,1.0976419)"><tspan
sodipodi:role="line"
x="3.101428"
y="3.4665947"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'JetBrains Mono';-inkscape-font-specification:'JetBrains Mono';fill:#595959;fill-opacity:1;stroke-width:0.101647"
id="tspan951">#⁵</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.94497px;line-height:1.25;font-family:sans-serif;fill:#595959;fill-opacity:1;stroke:none;stroke-width:0.123624"
x="5.4725542"
y="4.2744703"
id="text943"><tspan
sodipodi:role="line"
id="tspan941"
x="5.4725542"
y="4.2744703"
style="fill:#595959;fill-opacity:1;stroke-width:0.123624" /></text>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
viewBox="0 0 4.2333332 4.2333335"
height="16"
width="16"
version="1.1"
id="svg4"
sodipodi:docname="h6.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
<metadata
id="metadata10">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs8" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="712"
id="namedview6"
showgrid="false"
inkscape:zoom="16"
inkscape:cx="9.3285693"
inkscape:cy="14.591054"
inkscape:window-x="1920"
inkscape:window-y="111"
inkscape:window-maximized="1"
inkscape:current-layer="g869"
showguides="true"
inkscape:guide-bbox="true" />
<g
id="g869"
transform="translate(-2.6905974,0.16366866)">
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.0258px;line-height:1.25;font-family:Jetb;-inkscape-font-specification:Jetb;fill:#595959;fill-opacity:1;stroke:none;stroke-width:0.100646"
x="3.1351013"
y="3.4324441"
id="text933"
transform="scale(0.90206799,1.1085639)"><tspan
sodipodi:role="line"
x="3.1351013"
y="3.4324441"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'JetBrains Mono';-inkscape-font-specification:'JetBrains Mono';fill:#595959;fill-opacity:1;stroke-width:0.100646"
id="tspan951">#⁶</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-weight:normal;font-size:4.94497px;line-height:1.25;font-family:sans-serif;fill:#595959;fill-opacity:1;stroke:none;stroke-width:0.123624"
x="5.4725542"
y="4.2744703"
id="text943"><tspan
sodipodi:role="line"
id="tspan941"
x="5.4725542"
y="4.2744703"
style="fill:#595959;fill-opacity:1;stroke-width:0.123624" /></text>
</g>
</svg>
; (function ($) {
$(document).ready(function () {
// ajoute les barres d'outils markitup
function markdown_pp_load() {
$('.formulaire_spip textarea.inserer_md_barre_edition').barre_outils('md_edition');
$('.formulaire_spip textarea.inserer_md_barre_edition').barre_previsualisation();
}
markdown_pp_load();
onAjaxLoad(markdown_pp_load);
});
})(jQuery);
\ No newline at end of file
...@@ -4,6 +4,15 @@ ...@@ -4,6 +4,15 @@
if (!defined('_ECRIRE_INC_VERSION')) return; if (!defined('_ECRIRE_INC_VERSION')) return;
$GLOBALS[$GLOBALS['idx_lang']] = array( $GLOBALS[$GLOBALS['idx_lang']] = array(
// B
'barre_md_header_1' => 'Transformer en titre de niveau 1',
'barre_md_header_2' => 'Transformer en titre de niveau 2',
'barre_md_header_3' => 'Transformer en titre de niveau 3',
'barre_md_header_4' => 'Transformer en titre de niveau 4',
'barre_md_header_5' => 'Transformer en titre de niveau 5',
'barre_md_gras' => 'Mettre en **gras**',
'barre_md_italique' => 'Mettre en *italique*',
'barre_md_lien' => 'Transformer en [lien](https://...)',
// M // M
'markdown_titre' => 'Markdown', 'markdown_titre' => 'Markdown',
......
...@@ -166,3 +166,9 @@ function inc_titrer_contenu($champs_contenu, $c = null, $longueur = 80) { ...@@ -166,3 +166,9 @@ function inc_titrer_contenu($champs_contenu, $c = null, $longueur = 80) {
return $t; return $t;
} }
function markdown_header_prive($flux): string {
$flux .= "\n" . '<script type="text/javascript" src="' . _DIR_PLUGIN_MARKDOWN . 'javascript/markdown_pp.js' . '"></script>';
return $flux;
}
...@@ -17,7 +17,10 @@ ...@@ -17,7 +17,10 @@
<licence>GNU/GPL</licence> <licence>GNU/GPL</licence>
<necessite nom="porte_plume" />
<pipeline nom="pre_echappe_html_propre" inclure="markdown_fonctions.php" /> <pipeline nom="pre_echappe_html_propre" inclure="markdown_fonctions.php" />
<pipeline nom="pre_liens" inclure="markdown_fonctions.php" /> <pipeline nom="pre_liens" inclure="markdown_fonctions.php" />
<pipeline nom="pre_typo" inclure="markdown_fonctions.php" /> <pipeline nom="pre_typo" inclure="markdown_fonctions.php" />
<pipeline nom="header_prive" inclure="markdown_fonctions.php" />
</paquet> </paquet>
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter