GitHub satanically messing with Markdown – changes 666 to DCLXVI
stackoverflow.com
stackoverflow.com
This regularly screws up posts in /r/chess. Someone might post something like this:
1.e4 e5 2.f4 exf4 3.Nf3 g5 4.Bc4 g4
5.O-O gxf3 6.Bxf7+ Kxf7 7.Qxf3 Bc5+
8.Kh1 d6 9.c3 Nc6 10.d4 Nxd4 11.cxd4 Bxd4
12.Bxf4 Nf6 13.Bg5 Rg8 14.Qh5+ Rg6
and Reddit changes it to this: 1.e4 e5 2.f4 exf4 3.Nf3 g5 4.Bc4 g4
2.O-O gxf3 6.Bxf7+ Kxf7 7.Qxf3 Bc5+
3.Kh1 d6 9.c3 Nc6 10.d4 Nxd4 11.cxd4 Bxd4
4.Bxf4 Nf6 13.Bg5 Rg8 14.Qh5+ Rg6The second [1] is somebody that posted a ``` block but also indented all lines with four spaces. That renders as a code block with ``` lines before and after it on old Reddit, and as extra indented code on new Reddit.
If you use RES you can look at the raw Markdown code for each comment using the source link.
Maybe you´re thinking of inline code which use a single ` before and after the code content?
Screenshots: https://imgur.com/a/TKSKoEB
[0] https://www.reddit.com/r/cpp/comments/e16s1m/what_is_wrong_w...
[1] https://www.reddit.com/r/cpp/comments/e0fdp3/simple_timer_fo...
The old Reddit formatting wiki page doesn't mention ``` now I look, there's a note on new Reddit about sticking to spaces for compatability: https://www.reddit.com/wiki/markdown Would be nice if they fixed it indeed.
> It’s important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces.
It does cause a lot of surprising errors though, especially when the person isn't actually trying to write a list. For example, a case that comes up often is that someone will ask a question like, "when did this happen?" and someone will reply something like, "1986. It was a rough year." But due to markdown interpreting that as a list, it will get rendered as "1. It was a rough year."
Causes a lot of fun and confusion around ages too when it looks like someone's saying their child/significant other/etc. is one year old when they really typed a completely different age.
Huh. Is there a some reason why that's not obviously, bafflingly obtuse?
(Kind of like how Markdown and HN won't allow you to single-space text except in a code block)
> The point is, if you want to, you can use ordinal numbers in your ordered Markdown lists, so that the numbers in your source match the numbers in your published HTML. But if you want to be lazy, you don’t have to.
However, the complete disregard for the actual numbers seems to have been for ease of implementation in markdown.pl (the original implementation, which is what this doc is describing). The next paragraph notes:
> If you do use lazy list numbering, however, you should still start the list with the number 1. At some point in the future, Markdown may support starting ordered lists at an arbitrary number.
The solution would need to be not just that, but also letting every li be arbitrarily enumerated. And at that point it's not even an ol, it's a ul (from a machine perspective) where the author might happen to mimick an ol. Or just nothing structured at all -- which would probably be a net positive.
One of the original selling points of Markdown (at least in Gruber's post) is that is "seamlessly integrates" with HTML, in that you are in principle able to mix and match Markdown and HTML and get predictable HTML output. I think it was that aspect of Markdown that let it be so... sloppy?
That aspect of Markdown seems to have fallen away with the rise of Markdown extensions and standards.
Why do you want to single-space your text though?
In any case, it can be escaped by writing 1\. instead of 1.
I can think of plenty of reasons I would want to use auto-numbers while removing explicit numbers. But this is insane as a default behavior.
Agreed. The bit about "oh, well, it fixes mistakes if you rearrange items" falls in the astonishing (in a bad way) camp far too often. When you really meant to number the lines, "2, 4, 6, 8" and it "helpfully" changes this to "1, 2, 3, 4". Arguably it's bad also in a list that has been maintained over time and has out-of-sequence numbers, where the users are counting on the processor to renumber - now, if someone says to change item 37, is that the one numbered 37 in the rendered output, or in the source? Better to use a tool of some sort to physically renumber that section of the source document.
A better alternative for auto-renumbering would be to only have it kick in when the entire list all starts with "1. " and there's more than one line in the list (so "...meet me at<next line>1. Then we'll..." doesn't end up with a line being dragged into being a numbered list). Then, the repeated use of "1. " at the start of the line becomes a much more obvious indication that you want to numbered list.
Like #463 GitHub auto linking, which I usually like, but occasionally been caught by it.
I've had very similar experiences as you. Every automatic "correction" of user input needs to at least be clearly indicated and easily reversible. In my opinion it shouldn't even happen until the user actively signed off on the proposed modification.
I think the same argument can be made for almost every "the machine knows better than the user" decision, so it seems to me that this is pointing out that the Markdown list behaviour should be tarred with exactly the same brush.
This is true of all these features in general. They're all well-intentioned. No one wants to design a system that annoys users. But my criteria is meant to illustrate why it might not have been a smart idea to begin with: the user didn't indicate they wanted the system to renumber their bullet points. In fact, very often the user indicates that they want a specific numbering by placing specific numbers. The feature would work if there was some way to indicate this is just a bulleted list with numbers. Instead, the system assumes 100% of the time that the user made an error, then fixes that error in a way that is difficult to detect without ever providing feedback about the changes. That's a bad system that happens to usually be trivial or at most embarrassing. But the design itself is flawed from first principles.
A better way to implement auto-numbered lists would be indicate you want to use auto-numbered lists, just like you indicate you want to use headings, links, or any other element. First, don't rewrite all numbers, making the fact that a correction is taking place under the hood invisible to even experienced users. Auto-numbered lists should be indicated by having multiple lines starting with, say, "<space>0.", or even better "<space>#." to be more congruent with the use of "#" for headings and subheadings in other markdown systems (languages?). Second, when a user submits a post, the system should indicate what has been changed, perhaps with a non-intrusive highlight.
The problem would never have arisen had the developers asked my two questions "did the user indicate X?" and "where/how did the user indicate X?"
I suppose you should add onto that "is the change transparent to the user?" which is also known to cause some potentially life-threatening errors: http://www.dkriesel.com/en/blog/2013/0802_xerox-workcentres_... - you probably think "it's markdown, what's the big deal?", but who knows. Maybe someone gets some medical or chemistry advice and, sure, they shouldn't trust reddit, but then maybe someone dies anyway. So I think it's always best practice to indicate that a change has been made.
1. If you insert a misnumbered item in the middle of the list then when you come back later to edit the text you will be confused by how the numbers in the source are different from the numbers in the formatted output.
2. There's no point in using a numbered list unless you're going to refer to the number(s) somehow. (In this case I'm using the word "couple" to introduce the list!) Markdown doesn't sort out those references for you so in practice you have to manually renumber things anyway.
But I wouldn't—and it's a lot easier for you to process your Markdown and paste it into an HTML-enabled text field than it is for me to process my HTML and paste it into a text field that understands only one of the flavours of Markdown that doesn't have sufficient escape hatches built in (or that, like most flavours, has lots of features built in that you're apparently supposed to discover only by experimentation, preferably without any sandbox or preview available).
I propose a new term: paternalistic software. It's software that overdoes being helpful, and becomes annoying or dangerous. It's the software that does things you don't want automatically, because it thinks it knows better than you. Automatic renumbering and autocorrect both fall under this.
It looks like you're trying to write a rant against Clippy. Would you like help?
maybe the solution is to renumber if a list uses all 1's, but leave it untouched if it has different out of order numbers.
So this gets renumbered:
1. item 1
1. item 2
1. item 3
But this does not:
1.
3.
7.
Reddit could then offer "use our text-editor assistant in your browser" to those who aren't using one.
The text box would have to define what it allowed as input: alnum, plaintext, markdown, etc., and the appropriate plugin would activate?
The main value proposition was that the raw markdown looks like normal text. If you just want a simple mental parsing model, you use html or bbcode.
If it looks like normal text but get rendered to a different text it is a negative value proposition.
I think this isn't exactly fair, in that it seems to mislocate the problem——Markdown itself is so underspecified (I think Gruber never really expected it to take off the way it did) that the meaning of 'Markdown' can vary wildly from place to place, as a result of which there's no simple, universal test suite, and it's hard to tell on what sort of edge (or not-so-edge) cases your homerolled parser will trip until you actually deploy it (at which point people have come to rely so much on its quirks that it's difficult to fix it).
I would say this would still fall under the realm of readability and of being lightweight (as in a markdown text looks like someone that did not knew markdown could have written)
I actually hate all auto-"correction" features with a passion. After every Office update at work I have to go into the Outlook settings and manually disable all of that crap, but that still beats the hell out of having to live with it.
Literally one client just "lived with" one of their screens being yellow. Never thought to mention it.
Yeah, this one _is_ annoying. I'm not one to post chess games, but I've run into this one a bunch in other situations.
The _only_ case where this particular behavior is helpful is where one starts _every_ entry in a numbered list with (the same literal) "1. ", and lets Markdown sort it out - and that can be handy, because you can rearrange the list items and they still number properly, but in every other case it fails - it's a feature that produces more astonishment than happiness.
- GitHub satanically messing with Markdown - changes 666 to DCLXVI
- GitHub changes numbers to Roman numerals in lists
I’d call it functional clickbait.
ol ol, ul ol {
list-style-type: lower-roman;
}
I think that will result in all items starting with numbers in lists using Roman numerals.1. https://github.githubassets.com/assets/frameworks-481a47a969...
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.
...but yes, I do agree that markdown is definitely better when it's done right.
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.
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.)
It's a cool post but it has nothing to do with censorship. Am I the only one who was misled?
> which immediately follows the number. It's explained in the actual SO post.
Yeah, which is why it is on HN, what's your point?