[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
Persistent_id for ComponentDefinition always returns zero
How to apply bound.center for each group after groups.each?
Websocket: callback not functioning after window.locaiton=
Find area of scaled faces?
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
Help lines and wall
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
How create an attribute for guidepoint?
Error While loading sqlite3 in ruby
Parametric.rb
Texture inconsistent on the same component in different locations
Get the coordinate of a component
Extension to read & update .skp file
Add dimensions
Problem of control of the vertices
How to select inner faces of square wall
Is adding entities in Local or Global coordinates
Bugsplat after a component definition save_as
Attempting to load a component file from my disk via ruby script file I receive an Error: #<IOError: Invalid component file>
Count sub-components with the definition "TOTO"
Extract face area from component using generate report
Quotes in Text
Writing Functions in Ruby Code Editor
Changing icons on Mac and PC
Entities used by a Component Instance
How to update pages without changing settings of irrelevant section planes?
API Ruby ....face problem...help me
Transformations consistency problem
Unable to setup VS Code debugger for SketchUp Ruby
Win32Api Dll Load
Gem install issue
How to save extension preferences -- question about write_default & read_default
Problem with SUModelRelease
How do I create a component from an instance I have drawn?
Undo Stack, Sketchup Crash...why?
SUModelSaveToFileWithVersion has performance regression in version sketchup toolkit 21.0.339
Extracting Face Areas based on Layers in model groups
Need help identifying a Plugin used in a Tatlin Sofa You Tube video
Bounding Box of Component Instance is changing after adding lines to its entitiesBox
How to export multiple 2d views at once
Inserting a group or component with Ruby API
Need guidance on surface area script
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?
How do I create a component from an instance I have drawn?
The problem of ruby load c dll. editor says :'unknown symbol'
Sketchup C API how to add new layers to a model
Unit UI issue?
Iterate Over Existing Dimensions
Stop API calls from creating duplicate Materials
Problem in using Sketchup.open_file method
How to group groups
C++ observer?
Component attributes using Ruby
Persistent ID Errors when Copying Groups/Components
How to delete the same instances with simple code
How much iteration for dynamic component calculation?
Swapping Component definition with instance
Question about htmldialog and pushing variables from Ruby to Javascript
Installing and Signing developed RBZ
Get and change dynamic attribute
How can I do if I want to solve this problems?(ruby script)
SketchUp refuses to load my plugin after adding texture related API, C++
SketchUp refuses to load my plugin after adding texture related API, C++
Set rendering option "SectionCutDrawEdges" to false
Add_action_callback problem
How to draw a line from centerpoint of face?
Hide geometry lines with Ruby
Failed to add AutoText into LO by Ruby
Help w This Ruby Script for Orienting Components for Cut Sheet?
Juncture plane of two touching Solid group
Help me set funtion outer shell for components
Sending json post request in thirdparty api from sketchup
Somebody help me to make simple plugin for this code
Somebody help me to make simple plugin for this code
Newbie: face destroyed after transformation ?!?!?
Wrong face problem
How to edit rbs file?
API: SUEntitiesFill() return error code when export skp
Is there a way to bring the materials from the sketchup to the list?
Placing components within a model by x and y not the mouse
Getting prebuilt materials on a object
Select a box and edit it
Solving Drill.rb Problem
How can I select a point on a face?
Html dialog box to set and get information
What should i learn to be sketchup developer
LWPOLYLINE creating arcs from vertices / edges
Creating log files for ruby code
Add a group to an existing group
Issue with unused definitions
Get copper busbar side face
Namespace in Multiple .rb Files
Duplicate persistent id not fixed by 'Fix Problems' in Sketchup 2017
Component Rotation and movement
Nokogiri vs SU2018
Explode in ruby script
Selecting Faces inside multiple groups
Creating multiple groups from multiple surfaces
Cannot get a specific material from .skp file
Dynamic Components conflicting with modified versions when imported - code workaround
How to move entity in local axis
[code] undoable place_component() "MoveTool" clone
How is "lf" special
How is "lf" special
Creating log files for ruby code
Extension awaiting review
SU freezes when creating lines - ruby plugin
Can Sketchup execute a proc's
Union multiple instances
IFC Export - labelname sync definition
# 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