[How to] Post correctly formatted and colorized code on the forum?

Continuing the discussion from Ruby backtick returns nothing!:

Triple backtick delimiter lines.


  • image

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
Please correct this snippet of code
Issue with .html file on Box Drive
LWPOLYLINE creating arcs from vertices / edges
What should i learn to be sketchup developer
Html dialog box to set and get information
How can I select a point on a face?
Solving Drill.rb Problem
Select a box and edit it
Wrong face problem
Newbie: face destroyed after transformation ?!?!?
Somebody help me to make simple plugin for this code
Somebody help me to make simple plugin for this code
Sending json post request in thirdparty api from sketchup
Help me set funtion outer shell for components
Help w This Ruby Script for Orienting Components for Cut Sheet?
Hide geometry lines with Ruby
How to draw a line from centerpoint of face?
Add_action_callback problem
Set rendering option "SectionCutDrawEdges" to false
SketchUp refuses to load my plugin after adding texture related API, C++
SketchUp refuses to load my plugin after adding texture related API, C++
How can I do if I want to solve this problems?(ruby script)
Installing and Signing developed RBZ
Question about htmldialog and pushing variables from Ruby to Javascript
Swapping Component definition with instance
How much iteration for dynamic component calculation?
How to delete the same instances with simple code
Persistent ID Errors when Copying Groups/Components
C++ observer?
How to group groups
Problem in using Sketchup.open_file method
Stop API calls from creating duplicate Materials
Iterate Over Existing Dimensions
Sketchup C API how to add new layers to a model
The problem of ruby load c dll. editor says :'unknown symbol'
How do I create a component from an instance I have drawn?
Follow data in file in realtime and import them if data in file was changed. Ruby script
How do I create a component from an instance I have drawn?
Need guidance on surface area script
Inserting a group or component with Ruby API
How to export multiple 2d views at once
Need help identifying a Plugin used in a Tatlin Sofa You Tube video
Extracting Face Areas based on Layers in model groups
How do I create a component from an instance I have drawn?
Quotes in Text
Unable to setup VS Code debugger for SketchUp Ruby
Win32Api Dll Load
Transformations consistency problem
API Ruby ....face problem...help me
How to update pages without changing settings of irrelevant section planes?
Entities used by a Component Instance
Get the coordinate of a component
SU freezes when creating lines - ruby plugin
Error While loading sqlite3 in ruby
Changing icons on Mac and PC
How to apply bound.center for each group after groups.each?
How create an attribute for guidepoint?
Help lines and wall
Websocket: callback not functioning after window.locaiton=
Count sub-components with the definition "TOTO"
Attempting to load a component file from my disk via ruby script file I receive an Error: #<IOError: Invalid component file>
Bugsplat after a component definition save_as
Is adding entities in Local or Global coordinates
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
Issue with unused definitions
Extension awaiting review
Can Sketchup execute a proc's
Union multiple instances
Persistent_id for ComponentDefinition always returns zero
Find area of scaled faces?
Component Rotation and movement
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
Count sub-components with the definition "TOTO"
Duplicate persistent id not fixed by 'Fix Problems' in Sketchup 2017
Namespace in Multiple .rb Files
Creating log files for ruby code
Add a group to an existing group
Creating log files for ruby code
# 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: .

1 Like

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!

2 Likes

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

1 Like