Jump to content

Community

Syntax highlighting default in code blocks


cfish
 Share

Recommended Posts

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"?

Link to comment
Share on other sites

Posted (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:

code-select.png.142a4eac24ec87b9ed76b2157e9c2f61.png

Edited by cfish
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy