You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using mdBook in my Python libary project. The docs have a nice snippet of code for making a preprocessor in Python (thanks for that btw). However, I kept getting a KeyError saying that Chapter is not a valid key in the section. I couldn't even debug this since printing the output of the json would just be eaten by mdBook.
That is until today; instead of running print(book) I ran logging.error(book) which thankfully showed the entire json structure.
The reason for the KeyError was because the first entry was a part title.
GetPsyched
changed the title
Pytthon preprocessor example is ignorant of part titles
Python preprocessor example is ignorant of part titles
Jan 21, 2024
Problem
I am using mdBook in my Python libary project. The docs have a nice snippet of code for making a preprocessor in Python (thanks for that btw). However, I kept getting a
KeyError
saying thatChapter
is not a valid key in the section. I couldn't even debug this since printing the output of the json would just be eaten by mdBook.That is until today; instead of running
print(book)
I ranlogging.error(book)
which thankfully showed the entire json structure.The reason for the
KeyError
was because the first entry was a part title.Here's a small snippet of the JSON:
Proposed Solution
The JSON structure should be mentioned along with the preprocessor snippet.
And this code just doesn't work unless you change the index.
mdBook/guide/src/for_developers/preprocessors.md
Lines 118 to 119 in 01778fc
Notes
No response
The text was updated successfully, but these errors were encountered: