Skip to content

Buggy documentations for how to write your own mdbook plugin #2462

@VorpalBlade

Description

@VorpalBlade

Problem

The example code in https://rust-lang.github.io/mdBook/for_developers/preprocessors.html#hints-for-implementing-a-preprocessor doesn't actually work:

cmark(events, &mut buf, None).map(|_| buf).map_err(|err| {

That function (from https://docs.rs/pulldown-cmark-to-cmark/latest/pulldown_cmark_to_cmark/fn.cmark.html) only takes two arguments. I went back a few major versions and it still only took two arguments. So presumably it is just extremely outdated (or outright broken). (I have yet to figure out how to properly use the API, so I don't have a specific suggested fix at this point).

Steps

  1. Read docs on writing your own pre-processor.
  2. Try to use the example as a starting point.

Possible Solution(s)

  • The code should be updated to work.
  • The code should be tested by CI to ensure that it works. Possibly the easiest way to do this is to move it to the nop-example in repo instead.

Notes

No response

Version

mdbook v0.4.40
pulldown-cmark 0.12.2
pulldown-cmark-to-cmark 18.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: A bug, incorrect or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions