#dev 2024-01-28

2024-01-28 UTC
gRegor, gRegorLove_, tPoltergeist, [KevinMarks], angelo, bterry, [tantek] and geoffo joined the channel
#
tPoltergeist
ello, I'm writing a bare-bones web-server/content api in Go.. I write my content in Markdown and need to find a way to parse it to HTML.. has anyone found a simple no-nonsence library for this or is it viable to write your own implementation?
#
tPoltergeist
~ I briefly tried gomarkdown/markdown, but found it a little confusing with it's tree structure..
geoffo joined the channel
#
c​olinbate
Unless you really want to dive into it, writing your own is probably not worth it. I’ve seen goldmark mentioned a few times recently. https://github.com/yuin/goldmark
#
superkuh
Do you really want to write Markdown? HTML is fine.
#
[tantek]
Do you really want to write markup/down of any kind?
#
[tantek]
Plain text auto-linked/embedded (like in txt & chat apps like Slack) works great!
#
[tantek]
tPoltergeist what are your top 10 use-cases (features) that you feel you need/want Markdown for?
#
[tantek]
And welcome!
[Caleb_Hearth] joined the channel
#
[Caleb_Hearth]
Fit this crowd? Microformats must be up there
#
[Caleb_Hearth]
↩️ For*
#
tPoltergeist
thanks! I use markdown for most of my other (non-web related) content writing, so symmetry there would be nice. It can be easy to inject html directly into md content which is nice if I need richer markup (like microformats). My editor is set up to make the md editing experience really nice. It's also a little more portable than html I feel..
#
tPoltergeist
[tantek] what is meant by "auto-linked/embedded" plain text? Just .txt files of content? How does Slack fit in there? forgive my nievety
geoffo and colinbate joined the channel
#
c​olinbate
I think he is referring to having plain text with basic processing to link URLs and possibly provide some additional functionality based on those URLs (embedding YouTube videos, etc.). Presumably making white space a bit more sane as well.
sebbu, colinbate and gxt joined the channel
#
[tantek]
tPoltergeist no worries! It's a different perspective so it's non-obvious until pointed out. Literally the text entry experience when you're writing/sending a txt message on a smart phone or in a modern chat client like Slack
#
[tantek]
colinbate++ precisely!
#
Loqi
colinbate has 1 karma over the last year
#
[tantek]
There's a whole bunch more that some plain text entry UIs do for you too beyond auto-linking/embedding. E.g. Slack will turn asterisks * around words/phrases into *bold* and underscores _ into _italics_ apparently for a little inline formatting.
#
colinbate
Which works for notes, but for my normal use case which often involves bullet lists and code blocks, you can't beat being able to do that `easily`.
#
[tantek]
Slack also turns asterisk space "* " at the start of a line into a formatted list item like this:
#
[tantek]
• list item
#
[tantek]
1. Numbered list item
#
[tantek]
• Another just by pressing return
#
[tantek]
and number dot space "1. " at the start of a line into a formatted numbered list item like this:
#
[tantek]
2. Another just by pressing return
#
colinbate
Yes, and that is Markdown
#
[tantek]
Slack supports code formatting with backtick ` around words like this `<code>`
#
[tantek]
In many ways simpler and more plain text email compatible than Markdown which errantly turns a single asterisk * into italics (who thought that was a good idea? No one meant that in plain email) and uses the non-obvious double asterisk ** for bold
#
colinbate
Sure, but you can use an extension for Markdown to tweak that if it is your preference
#
[tantek]
Lists are one of the few things markdown got reasonably right (no need to remember any special formatting), unlike links & images which require weird nonobvious forgettable & noisy extra punctuation
#
[tantek]
It's not a matter of preference. Once you change behaviors from "normal" Markdown or e.g. CommonMark, then you're using a dialect that is subtly incompatible with all the places that expect "normal" Markdown like GitHub which you can't change
#
colinbate
I agree, which is why when I see implementations of almost but not quite Markdown, I'm a bit disappointed. As for who thought a single asterisk as italic was a good idea, I guess John Gruber did :)
#
[tantek]
My point is that txt messaging and chat plain text entry is far more obvious to far more people, and requires a lot less (like nearly zero) thinking/cognitive load about "punctuation markup", so it's reasonably to pursue that path for a new text entry UI instead of Markdown
#
[tantek]
It's not clear if it was John Gruber or aaronsw (RIP). I don't think either blogged about the details about who came up with which features in the initial Markdown proposal/implementation or if they both did together
#
[tantek]
colinbate WDYT about the trailing space (or two!) on lines interpretation in Markdown (I forget which one makes a hard break and which one Markdown "unbreaks" the line (treats a line break as line continuation space rather than a semantic line break)
#
colinbate
I guess either way, if you want full Markdown, or something almost Markdown, it looks like `goldmark` should get you there.
#
[tantek]
I find the idea of a single trailing space on a line appealing to indicate a line continuation semantic because that's what results if you take a long paragraph and *only* add line breaks to make it soft-wrap e.g. for a plain text email context
#
colinbate
Yea, two spaces for a <br>
#
[tantek]
A-ha that's reasonable too. How about zero trailing spaces? I'd want that to also mean <br>
#
[tantek]
except when after a dash/hyphen obviously
#
colinbate
Unfortunately that is just considered as a single collapsed whitespace node
#
colinbate
I wrote my own parser for plain text blog post formatting back in like 2001 and it treated all line breaks as hard breaks and supported basic lists but I was always finding edge cases and additional things to support, which is fine if that is something you want to take on
#
colinbate
But when Markdown emerged, it was like, yea, that's what I wanted (more or less)
#
tPoltergeist
wow, thanks for all the great info! I didn't clarify the project I'm working on will only be used by me, so the semantics of markdown don't matter bc I'm the only user and am comfortable with md. The majority of content will just be plain text which won't need any special parsing to html, so I may try writing a small library to convert my most used md syntax elements to html.. at worst it'll be a learning experience