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

lexing
colourize
colorize

#1

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:

```text
paste error message here
```

If it is Ruby, then:

```ruby
# code here
```

If it is Javascript, then:

```javascript
/* js code here */
```

If it is HTML, then:

```html
<!-- html here -->
```

If it is C, then:

```c
// 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
Please correct this snippet of code
What should i learn to be sketchup developer
Issue with unused definitions
Extension awaiting review
Can Sketchup execute a proc's
Union multiple instances
Is adding entities in Local or Global coordinates
Find area of scaled faces?
Count sub-components with the definition "TOTO"
Count sub-components with the definition "TOTO"
Dynamically changing color of entity created with ruby is very slow
Make unique, a manually placed component
Observer for recognize object moved
Need to place the loaded component with my courser and place on a click
Alternative to get_element_value method for HtmlDialog
SketchUp Ruby coding a dialog
Skp2Xml for 2017 causes crash
How to Apply Material and Texture to model p-a-r-s-e-d using sdk in unreal
Apply material to all nested or non-nested instances that have the dynamic attribute "x" in the selection
How to Use SUTransform to correctly render my geometry?
Measure units of 3dPoint
Persistent_id for ComponentDefinition always returns zero
How to select inner faces of square wall
Problem of control of the vertices
Add dimensions
Extension to read & update .skp file
Texture inconsistent on the same component in different locations
Parametric.rb
#2
# Test
module Eneroth3::TestSyntaxHighlight
  def self.method_name
    puts "String"
    5+12
    yield false
    return true
  end
end

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


#3

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!


#4

#6

#7

#9

Welcome Dylan … the wikipedia page (linked below) explains what markdown is in detail.

But it is basically a simple, human-readable text code that can be used to nicely format posting on the web or documents.

The forum system should have sent you a message explaining the basics of using markdown on the forum.
(Click you avatar menu at the top right, see if the welcome message from the system is there.)