Recent(?) markdown changes seem to screw up formatting on some older posts

Platform: Website
Browser: Firefox

https://inaturalist.laji.fi/observations/49288672

I’ve always written descriptions and comments in my own observations in both English and Finnish, separated by a line with only three dashes on it. (Since most of the people looking at Finnish observations will probably be Finnish, but English obviously has a better chance of being understood by everyone else)

In the past, it has looked fine - with the three dashes displayed as, well, three dashes (or a short line). When I looked at a few of my old observations just now, I immediately noticed that the English versions are now HUGE AND BOLD. I haven’t added new observations in a while (new camera, haven’t yet figured out a good workflow :), nor looked at my old ones, so I don’t know when this has changed.

It seems like the markdown used by iNaturalist formatting has been changed, and a line consisting only of one or more dashes below another line now makes the preceding line a heading. This is all well and good - for anything that was written after the change - but shouldn’t things written before the change be displayed like they were when they were first written, as the author intended? As it is, the formatting on all my writings now suddenly looks like it was done by a crazy person, due to no fault of my own. :D

Maybe anything written before <insert-date-of-change> should use the old markdown-to-html conversion code? Or be fed through some code that escapes any new markdown introduced after the change, before being fed to the new markdown-to-html converter? (I noticed backslash seems to work for escaping at least the dashes-make-headers thing - at least in this forum editor - but I don’t know what other markdown might’ve been introduced in the change)

I hope it’ll be fixed; I only have 40-odd observations, but I’m still not looking forward to combing through them (and all my comments) to find and fix all the screwed-up formatting - I can’t even imagine how tedious it would be for someone who actually has tons of observations, and has used dashes (or other things that are now recognized as markdown) in a similar manner. And that’s assuming they even notice the problem - for someone who doesn’t use dashes like this regularly, but has done it once or twice, the formatting on some of their old posts is now screwed up, and they might never notice it themselves. (Given that iNaturalist has millions of users, and I don’t think I’m the only one who has ever used dashes like this, I assume the iNaturalist database at the moment has a bunch of “mines” like this)

1 Like

Hm, we haven’t changed our Markdown parser recently (though a few of its dependencies may have changed, so that might be the cause). However, what you’re seeing is valid Markdown, so I’m not sure the code needs to change. You can test it here on Discourse:

this is a header
---
this is the body

becomes

this is a header

this is the body

There are a couple ways you could fix the syntax to get what you want, including

this is a header
\---
this is the body

which becomes

this is a header

this is the body

or

this is a header

---

this is the body

which becomes

this is a header


this is the body

If you want, I can just replace all of the --- in your observations and comments with one of those two options. Just let me know which one you prefer.

2 Likes

Hm, well, “recent” might’ve been misleading - I just checked that my last new observation (with a description) is from ~4 months ago, so I know back then “—” didn’t create a header yet, but I have no recollection as to when I’ve last revisited an old observation (that has a description), so all I can say that the change happened somewhere between then and now.

I understand that “—” is valid markdown - in most (there isn’t a one true standard, after all) markdown flavours. However, since it didn’t create a header in iNaturalist 4 months ago, clearly back then iNaturalist was using a markdown flavour that doesn’t recognize that as markdown - so at some point the flavour of markdown that iNaturalist uses changed.

And just to be perfectly clear, I don’t think that there’s anything wrong with that, supporting more formatting can be great. But I also think care should be taken to not break previous content when markup changes are introduced. (Ie. I think old content should either be processed as the old markup that it is, or converted to the new markup)

I did actually stumble onto both options for fixing the formatting while writing the bug report (the backslash escape I even mentioned in the post), and I think the backslash-escaped literal “—” fits my use better. But truthfully, I’m more worried about the unknown number of unintentional formatting changes the markup change has caused for other people’s content in the whole iNaturalist database, rather than the few known cases that hit me, personally.

2 Likes

The problem with markdown is that it is changing text, layout and i really have no idea to switch of Markdown fully.
How can one do that ?

Unintentional formatting was a risk we decided to take when we launched Markdown support, one that was far outweighed by the benefits, IMO. If we weren’t supporting that style of header when we launched Markdown support, then that was a bug that has been (unintentionally?) fixed.

Again, I’m happy to help fix your records if you’d like, just let me know if you want me to and what approach I should take. However, the issue you’ve reported isn’t a bug, so I’m going to mark this as resolved.

1 Like

reach out to kueda if you’d like to take him up on the offer to fix past records. thanks!