[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
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
Alternative to get_element_value method for HtmlDialog
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
Issue with unused definitions
What should i learn to be sketchup developer
Union multiple instances
Please correct this snippet of code
#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

#8

markdown what is it


#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.)