cfish Posted April 29, 2021 Posted April 29, 2021 By default, the syntax highlighting in code blocks is set to HTML. This may be OK for the majority of forums, but if a forum is a special interest group for a different code language, users must set the value every time they use a code block. Is there a way to change the default to something other than HTML, even if it's "No Syntax Highlighting"? SeNioR- 1
cfish Posted April 30, 2021 Author Posted April 30, 2021 (edited) So I found the template file for the code block modal in Core>global>editor>code: <div class="ipsPad ipsForm ipsForm_vertical" data-controller='core.global.editor.code' data-editorid='{$editorId}' data-randomstring='{$randomString}'> <form method='get' action='#'> <div class="ipsPad ipsAreaBackground_light"> <div class="ipsFieldRow ipsFieldRow_fullWidth ipsFieldRow_primary ipsLoading" data-role="codeContainer"> <textarea id='elCodeInput{$randomString}'>{$val}</textarea> </div> <div class='ipsFieldRow'> <button type='submit' class="ipsButton ipsButton_primary cEditorURLButton cEditorURLButtonInsert" data-action="linkButton">{lang="editor_media_insert"}</button> <div class="ipsPos_right"> <select id='elCodeMode{$randomString}' data-role="codeModeSelect" data-codeLanguage="{$language}"> <option value="null">{lang="editor_code_null"}</option> <option value="htmlmixed" {{if $language == 'html' OR $language == 'htmlmixed'}}selected{{endif}}>{lang="editor_code_htmlmixed"}</option> <option value="css" {{if $language == 'css'}}selected{{endif}}>{lang="editor_code_css"}</option> <option value="javascript" {{if $language == 'javascript'}}selected{{endif}}>{lang="editor_code_javascript"}</option> <option value="php" {{if $language == 'php'}}selected{{endif}}>{lang="editor_code_php"}</option> <option value="sql" {{if $language == 'sql'}}selected{{endif}}>{lang="editor_code_sql"}</option> <option value="xml" {{if $language == 'xml'}}selected{{endif}}>{lang="editor_code_xml"}</option> </select> </div> </div> </div> </form> </div> Would the solution be as simple as changing the null option to be "selected"? UPDATE: Editing this template makes no difference to the drop-down and the options must be coming from elsewhere? This would make sense because the options on the actual drop-down don't match those shown in the template: Edited April 30, 2021 by cfish SeNioR- 1
Refsmmat Posted June 10, 2022 Posted June 10, 2022 Hi, have you ever figured how to extend the list of supported languages?
teraßyte Posted June 11, 2022 Posted June 11, 2022 That list is updated with a javascript controller. I don't have access to the code right now to check the exact name/path though.
cfish Posted June 12, 2022 Author Posted June 12, 2022 On 6/10/2022 at 9:14 PM, Refsmmat said: Hi, have you ever figured how to extend the list of supported languages? I'm afraid not. After a lot of research with no progress, I gave up. I would still dearly love to make it happen, but I have no idea how to do it. If you have better luck than I did, please do let me know. On 6/11/2022 at 1:10 AM, teraßyte said: That list is updated with a javascript controller. I don't have access to the code right now to check the exact name/path though. Any help on this would be most welcome. Refsmmat 1
Nathan Explosion Posted June 12, 2022 Posted June 12, 2022 On 4/29/2021 at 5:59 PM, cfish said: Is there a way to change the default to something other than HTML, even if it's "No Syntax Highlighting"? (NE) Change 'Code' default language.xml SeNioR-, cfish and Adriano Faria 1 1 1
cfish Posted June 12, 2022 Author Posted June 12, 2022 Thanks @Nathan Explosion I'll give that a try.
Recommended Posts