md is broken

This morning I couldn’t get some of my (private) notebooks to work. Markdown cells seemed partially broken.

Not sure if it’s on my side, but I’ve asked colleagues to check and they had similar issues.

For example, here’s a screenshot of a broken md cell.

In the console I saw some 403 errors too. [EDIT] probably not relevant

The markdown is wrapped inside a block level element and therefore not processed. Here’s how to make it work:

Yep, the issue was more about notebooks being subtly broken than how to fix this particular one.

In my case I had a few

md`${viewof thing}`

but maybe I’m tempting the devil here.

Still not quite sure what you mean by “broken”. In the above example you may have to use

md`${await viewof thing}`

Edit: Do you mean that the behavior of the md template tag literal has changed?

(I really need to put more care into reading posts.)

~14h ago an update to observable’s stdlib was published that made some changes to how marked is integrated:

Edit: One difference appears to be that the old implementation would always return a promise.

Edit 2: Looks like marked got updated from 0.3.12 to 0.6.1 in the process.

Edit 3: I believe the old behavior was due to faulty parsing, and the current behavior is the correct one. So I’m guessing that existing notebooks will have to be fixed manually.

1 Like

Yes, this breakage appears to be caused by our upgrade from 0.3.12 to 0.6.1 of Marked. We’re investigating.

(I merged @mootari’s fork. Thank you! But you can still see the broken version here, for context in this thread.)

1 Like

Apparently putting a template at the beginning of a markdown line now breaks things. It didn’t used to.

Example, https://observablehq.com/d/b85adcc5ea123dc7

I would expect this to break a decent number of existing notebooks, but someone would have to go carefully through every one to find where.

1 Like

We’ve reverted back to the earlier version of marked (0.3.12). Sorry for the inconvenience!

I glanced some security fixes in the marked changelog. Is the downgrade only temporary until another solution has been found?

Out of curiosity, what made you pick marked as your markdown library of choice?

Those security fixes aren’t relevant to our usage. We don’t rely on Marked to do any sanitization and there’s no threat of DoS because Marked is running on the client.

If and when we upgrade Marked in the future (or replace it with a different Markdown implementation), our plan is to implement versioning pinning for the Observable standard library so that this change only becomes available to new notebooks and old notebooks that explicitly opt-in to the upgrade.

3 Likes

Thank you.

(this made me realize I did not really need md to assemble my {viewof x} together and could use html instead :slight_smile: )