Rich text formatting is now available on forum.dlang.org

Vladimir Panteleev thecybershadow.lists at gmail.com
Thu Apr 1 07:27:38 UTC 2021


(This post best viewed on 
[forum.dlang.org](https://forum.dlang.org/)!)

Greetings esteemed forum users,

I am delighted to announce that as of today, you can use rich 
text formatting in forum.dlang.org messages.

This should help make code samples more readable, format tabular 
information as actual tables, but also add *subtle* or **strong** 
emphasis to your posts and hopefully improve how we communicate 
with our fellow netizens.

I have deliberated for a bit on which markup syntax to use—but, 
all things considered, there is really only one answer. There 
already exists an elegant and well-established markup language 
that members of our community are well familiar with, which is 
what has been implemented today. I am, of course, talking about 
DDoc!

To get you started, here is a primer:

- `$(B bold text)` → **bold text**
- `$(I italic text)` → *italic text*
- `$(D inline code)` → `inline code`
- `$(LINK https://dlang.org/)` → https://dlang.org/
- `$(LINK2 https://dlang.org/, The Best Programming Language)` → 
[The Best Programming Language](https://dlang.org/)
- Need to escape a special character? `$(DOLLAR)`, `$(LPAREN)` 
and `$(RPAREN)` are there and do exactly what they say.

Inline code blocks are easy:

     ---
     import std.stdio;
     void main() { writeln("Hello, world!"); }
     ---

becomes:

```d
import std.stdio;
void main() { writeln("Hello, world!"); }
```

Tables are even easier:

     $(TABLE $(TR $(TH Year) $(TH D users))
     $(TR $(TD 2010) $(TD 10,000))
     $(TR $(TD 2020) $(TD 100,000))
     $(TR $(TD 2030) $(TD 1,000,000)))

becomes:

| Year | D users |
|------|---------|
| 2010 | 10,000  |
| 2020 | 100,000 |
| 2030 | 1,000,000 |

And if the above is not sufficient to express your intent, there 
is the nuclear option: `$(SCRIPT ...)`, which allows embedding 
arbitrary JavaScript to format your post in however way you 
desire. jQuery is preloaded, so go nuts!

If you are not using the forum.dlang.org web interface, no 
worries—messages will still come through to you in good old plain 
text. And, if you're not a fan, you are in control: you can 
disable DDoc formatting in the posting form, or completely 
disable DDoc rendering on [the settings 
page](https://forum.dlang.org/settings).

Happy DDoc-ing!

— Vladimir



More information about the Digitalmars-d mailing list