[How to] Colourize code on the forum? (wiki)



Continuing the discussion from Ruby backtick returns nothing!:

Triple backtick delimiter lines.

  • backquote on US keyboard

Backquote character key on US keyboard.

If it is error message text (or some other plain text that contains <, >, #, or other characters that can confuse Discourse markdown,) then specify “text” as a lexing language:

paste error message here

If it is Ruby, then:

# code here

If it is Javascript, then:

/* js code here */

If it is HTML, then:

<!-- html here -->

If it is C, then:

// C code here

… etc. (Discourse code lexer recognizes the major programming languages.)

How To Make Custom Dynamic Component Attribute
Issue with .html file on Box Drive
Extension awaiting review
Persistent_id for ComponentDefinition always returns zero
Measure units of 3dPoint
How to Use SUTransform to correctly render my geometry?
Apply material to all nested or non-nested instances that have the dynamic attribute "x" in the selection
How to Apply Material and Texture to model p-a-r-s-e-d using sdk in unreal
Issue with unused definitions
SketchUp Ruby coding a dialog
Need to place the loaded component with my courser and place on a click
Observer for recognize object moved
Make unique, a manually placed component
Dynamically changing color of entity created with ruby is very slow
Count sub-components with the definition "TOTO"
Count sub-components with the definition "TOTO"
Find area of scaled faces?
Skp2Xml for 2017 causes crash
What should i learn to be sketchup developer
Union multiple instances
Please correct this snippet of code
# Test
module Eneroth3::TestSyntaxHighlight
  def self.method_name
    puts "String"
    yield false
    return true

I had no idea this forum supported syntax highlighting :open_mouth: .


Yep! Discourse processes your post’s text through a Markdown language formatter, and implements this feature of Markdown. The Markdown formatter is also why posts of error messages and code can get so screwed up if people don’t use the triple backtick syntax!