this post was submitted on 20 Jul 2023
87 points (97.8% liked)

Lemmy

12506 readers
33 users here now

Everything about Lemmy; bugs, gripes, praises, and advocacy.

For discussion about the lemmy.ml instance, go to !meta@lemmy.ml.

founded 4 years ago
MODERATORS
 

Hey everyone, I figured that some new users might not know that comments and posts have a formatting standard called Markdown.
In simple terms, Markdown is a (semi)universal language that uses formatting symbols to give a certain style to a portion of text.
This quick guide can help you to write in a way that's more appealing and easy to read.

FORMATTING SYNTAX EXAMPLE
New line put two spaces at the end of the line you want to break Line__
New paragraph return two times at the end of the paragraph Line↵↵
Horizontal rule between each paragraph put three "-" or "*" ***
Bold put your text between two "**" or "__" **Bold** or __Bold__
Italic put your text between two "*" or "_" *Italic* or _Italic_
~Sub~script put your text between two "~" ~Subscript~
^Super^script put your text between two "^" ^Superscript^
Inline code put your text between two "`" `sudo rm -rf /`
Headings and Titles put one or more "#" at the beginning of the line # Headings for level 1, ## Headings for level 2...
Blockquotes put ">" at the beginning of the line > Blockquote
Links put the the text between [ ] and the link between ( ) [Links]( https://piped.video/watch?v=dQw4w9WgXcQ )
Images Images like links but you put "!" before the first square bracket ![Images]( https://lemmy.ml/pictrs/image/fa6d9660-4f1f-4e90-ac73-b897216db6f3.png?format=webp&thumbnail=96 )

You can also do unordered lists using "-" at the beginning of each line:

- Salt
- Potatoes
- Beans

will become

  • Salt
  • Potatoes
  • Beans

Or ordered list by putting "1." at the beginning of each line:

1. Salt
2. Potatoes
3. Beans

will become

  1. Salt
  2. Potatoes
  3. Beans

You can save other users from spoilers by encasing a paragraph between a section that starts with ":::" followed by a space and the word "spoiler" + the title of the spoiler and ends with ":::". The spoiler will be hidden inside a menu and you'll be able to see it if you click on it

warning! spoiler!
the butler did it

will become

warning! spoiler!the butler did it


In the end you can also format big code blocks by putting "```" at the beginning and at the end of each paragraph

```
println("Hello World!")
```

will become

    println("Hello World!")  

Last but not least remember that you can always use break formatting syntax by putting "\" in front of a character:
so if I want "^" in my text without having the rest of the paragraph in superscript, I'm simply going to write "\^"


Now go and have fun!

top 22 comments
sorted by: hot top controversial new old
[–] Notnotmike@beehaw.org 9 points 1 year ago* (last edited 1 year ago)

Just want to plug markdown as a phenomenal resource. You can use it to write documentation both online and offline, and with pandoc you can even use it to create beautiful PDF documents from your computer. Here's some places I use markdown daily, some additional resources, and tips

  • GitHub parses markdown files from their web UI by default
  • Obsidian uses markdown for their note taking application
  • Pandoc can convert Markdown files to other formats including PDF
  • Because it's plaintext, there are fewer formatting errors when moving between applications and you don't even need an application to read them
  • Plaintext also means documents can be easily tracked via source control
  • Lemmy and Reddit both use Markdown
  • Discord uses a variation of Markdown
[–] Coelacanth@feddit.nu 6 points 1 year ago (4 children)

@pH3ra@lemmy.ml

Not sure your example formatting for spoiler tags is correct, this is what it looks like on my end (using Jerboa)

[–] pH3ra@lemmy.ml 4 points 1 year ago

Yeah I just noticed: it's a problem on Jerboa's side, probably the Md parser doesn't handle well spoilers.
On browser shows up the way I intended

[–] callyral@readit.buzz 1 points 1 year ago* (last edited 1 year ago)

yeah it kinda looks like that for me too but on kbin

[–] MajinBlayze@lemmy.world 1 points 1 year ago* (last edited 1 year ago)

I don't think it's standard markdown, so apps might not implement it consistently.

[–] Coeus@coeus.sbs 1 points 1 year ago

I'm seeing the same thing on Thunder

[–] rikudou@lemmings.world 4 points 1 year ago (3 children)

Half of it doesn't work in Liftoff.

[–] pH3ra@lemmy.ml 4 points 1 year ago* (last edited 1 year ago) (1 children)

I'm on Jerboa and everything works just fine

[Edit]: everything except spoilers

[–] Wincing5185@mastodon.online 1 points 1 year ago

@pH3ra @rikudou

Jerboa works fine for me

[–] jochem@lemmy.ml 3 points 1 year ago

Markdown is notoriously understandized, so there are lots of unofficial extensions. This is a major downside of markdown, as you cannot trust a renderer to properly show the formatting beyond the basics.

It's still really nice, because of two great features:

  • it's super easy to learn. Just look at a few examples and off you go.
  • even when it's not rendered, it's still easy to read (which I think contributes to making it easy to learn).
[–] Notnotmike@beehaw.org 1 points 1 year ago

The Markdown will be passed in the ActivityPub messages in plaintext, so it's up to the app developer how to interpret the Markdown. Looks like someone already created a ticket on GitHub so I'd recommend either adding a thumbs up to increase visibility or make the change yourself if you're able!

[–] ilovesatan@lemmy.world 4 points 1 year ago

I FUCKING LOVE MARKDOWN

[–] Vlyn@lemmy.ml 4 points 1 year ago (1 children)

I'm so confused about the new line syntax. Why can't I just do a single new line and keep typing? Why does the previous line have to end with a double space?
It's weird, what is the benefit there?

[–] jochem@lemmy.ml 1 points 1 year ago

If I would guess, then it has to do with making long lines fit in a window without requiring horizontal scrolling.

Markdown is used a lot in the context of software development. Software code is usually accompanied by a readme, detailing what it does, how to setup your environment for development, how to contribute, etc.

The defacto standard is to write this in markdown. Since it's written in a software development program (an IDE), you don't have text wrapping, meaning lines continue when they don't fit in the window. This is because otherwise the code becomes unreadable. Most code can also be kept to fairly short lines, normally not requiring any horizontal scrolling. However, a long sentence in a readme will easily become much longer than a line of code. So being able to break a line anywhere without having an actual line break in your rendered output is super useful for that.

This is btw how html also behaves. Markdown gets rendered to html.

[–] Terevos@lemm.ee 3 points 1 year ago (1 children)

Yeah.. This post looks like this for me:

[–] Coelacanth@feddit.nu 3 points 1 year ago (1 children)

Using Connect? The various third-party apps seem to have different troubles with Markdown, I get that same result viewing this post on Connect, but it seems to work fine on Jerboa.

[–] Terevos@lemm.ee 2 points 1 year ago

Yeah Connect. Sorry I was going to mention my client but somehow forgot to.

[–] burgersc12@sh.itjust.works 2 points 1 year ago (1 children)

Your Markdown is broken lol.

[–] pH3ra@lemmy.ml 3 points 1 year ago

If you're seeing this witha a smartphone client, some of them might display markdown in a weird way.
On browser everything works fine, on Jerboa most of it works fine

[–] capy_ora@discuss.online 1 points 1 year ago
[–] itsmikeyd@lemmy.ml 1 points 1 year ago

I use VS Code with a few markdown extensions to write my longer, more complex posts. It gives a preview in real time. The extension "markdown all in one is" awesome.

No way to do inline spoilers?

load more comments
view more: next ›