rust-lang / rustfmt

Format Rust code
https://rust-lang.github.io/rustfmt/
Apache License 2.0
5.85k stars 860 forks source link

Docs failing to load due to markdown parser breaking changes #6197

Closed jakeswenson closed 1 week ago

jakeswenson commented 2 weeks ago

The rustfmt docs site is failing to load for me.

I've tracked it down to what looks like a change in marked.

Specifically the heading function is now handed a single object argument instead of what the current code is expecting.

In marked:

case 'heading': {
  out += this.renderer.heading(token);
  continue;
}

https://github.com/markedjs/marked/blob/70bb55e0af5128a657a14b8b25d7d406661e6936/src/Parser.ts#L69-L71

Marked made an API contract breaking change for this: https://github.com/markedjs/marked/pull/3291

In rustfmt page: https://github.com/rust-lang/rustfmt/blob/c97996fab61fc09432abcf64dbe3ce2d84f4d679/docs/index.html#L172-L178

htmlToId is now failing because text is an object, and doesn't have a .trim() method https://github.com/rust-lang/rustfmt/blob/c97996fab61fc09432abcf64dbe3ce2d84f4d679/docs/index.html#L304-L308

jakeswenson commented 2 weeks ago

Quickest fix would be to pin to a proper major version for marked https://github.com/rust-lang/rustfmt/blob/c97996fab61fc09432abcf64dbe3ce2d84f4d679/docs/index.html#L8

Setting it to https://cdn.jsdelivr.net/npm/marked@12/marked.min.js works for me locally

jakeswenson commented 1 week ago

Fixed in #6194