Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
VorpalBlade opened this issue Oct 28, 2024 · 1 comment · Fixed by #2464
Closed

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

VorpalBlade opened this issue Oct 28, 2024 · 1 comment · Fixed by #2464
Labels
C-bug Category: A bug, incorrect or unintended behavior

Comments

@VorpalBlade
Copy link

VorpalBlade commented Oct 28, 2024

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

@VorpalBlade VorpalBlade added the C-bug Category: A bug, incorrect or unintended behavior label Oct 28, 2024
@ehuss
Copy link
Contributor

ehuss commented Nov 2, 2024

Thanks for the report! I have posted #2464 with a fix, which includes a fully working example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: A bug, incorrect or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants