News for hackers. Stuff that matters.
Re:GitHub satanically messing with Markdown – changes 666 to... by laumars on Tuesday November 26, 2019 @02:55AM (#21636373)
Better for some things / worse for others.

It was much easier to write parsers for though. Most of the BBCode tags could be rendered with simple regex substitutions.

Re:GitHub satanically messing with Markdown – changes 666 to... by contravariant on Tuesday November 26, 2019 @07:06AM (#21637549)
>It was much easier to write parsers for though. Most of the BBCode tags could be rendered with simple regex substitutions.

Nevermind. Let's not bring BBCode back.

Re:GitHub satanically messing with Markdown – changes 666 to... by laumars on Tuesday November 26, 2019 @08:56AM (#21638253)
On the whole I'd agree. When markdown is done right it's pretty awesome. However I'd still take BBcode over buggy half implemented markdown parsers like the one we have on HN. At least [i] is a less common token than * -- which leads to no end of edits when I've absent-mindedly emphasised something that should have been bullet pointed.

...but yes, I do agree that markdown is definitely better when it's done right.

Re:GitHub satanically messing with Markdown – changes 666 to... by CarlRJ on Tuesday November 26, 2019 @11:28AM (#21639734)
On second thought, let us not go to Camelot. It is a silly place.
Re:GitHub satanically messing with Markdown – changes 666 to... by brohee on Tuesday November 26, 2019 @07:46AM (#21637764)
Re:GitHub satanically messing with Markdown – changes 666 to... by laumars on Tuesday November 26, 2019 @08:44AM (#21638160)
> Seriously... https://blog.codinghorror.com/regular-expressions-now-you-ha... .

The key words I used were "most" and "simple". I'm well aware of the pitfalls of regex and have seen many horror stories myself but I'm not talking about parsing HTML nor other complex documents and nor am I suggesting you write the entire parser in regex. I'm talking about simple find and replaces for common static tags when you're only supporting a subset of BBcode. eg:

    form := "this is just a [b]crude[/b] example"
    rx := regexp.MustCompile(`\[b\](.*?)\[/b\]`)
    form = rx.ReplaceAllString(form, `<strong>$1</strong>`)
    fmt.Println(form)
(https://play.golang.org/p/GK7OGt2mHb6)

You could even use string find/replace but that wouldn't capture missing closing tags.

Things obviously get more complicated if you want to support some of the BBCode supersets like:

    click [url=example.com]here[/url] to load example.com
...but by that point you're dealing with a reasonably competent contributor who might feel better at home with markdown anyway (I know I would).

> And this piece of computer trivia archeology http://regex.info/blog/2006-09-15/247

Doesn't feel much like archaeology to me because I used to work a lot in Perl in the late 90s and 00s :) Though, and at risk of re-igniting old flamewars, I always preferred vi to emacs even despite having a fondness for LISP.

Re:GitHub satanically messing with Markdown – changes 666 to... by CarlRJ on Tuesday November 26, 2019 @11:32AM (#21639780)
> Though, and at risk of re-igniting old flamewars, I always preferred vi to emacs even despite having a fondness for LISP.

That's because vi is a better text editor (as the old saw goes, emacs is a nice OS, but it lacks a decent text editor.)