-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Convert all code listings to use new <Listing>
preprocessor
#3919
Comments
I'd like to help with chapter 1. |
Thanks for the feedback for my pervious contribution! I plan to work on converting chapters 2 and 3 |
Very good! Thank you! 💙 |
I'll do chapters 6-10. Already working on it. |
I am working on converting chapter 11. |
I'm in the process of converting 12-15. It is mostly working but all captions which have angle brackets (eg |
Interesting – I would not have expected that! 🤔 Let me know what you come up with. |
The issue appears to be that |
I've been quite busy over here, I hope to get back to work soon and finish the chapters. |
How do I build the mdbook with the Listing pre-processor? If I recall correctly, |
Also, what about code that is preceded by a filename, yet doesn't have a listing number? Are these also turned into |
@SpectralPixel sorry, just saw these questions.
|
Hmmm, I already converted those special |
Weird, mdbook seems not to work on my machine when I install it the way that is recommended for this repo... I guess I'll just send the PR so you can check if it works fine, it's probably just me doing something wrong with mdbook... |
@SpectralPixel if you consistently have issues with mdbook not working, would you open an issue? That way we can track fixing that—it’s important to us to make sure folks can contribute easily! |
Well, I'm not sure if I have it set up properly... |
@SpectralPixel @bzierk I believe #3975 should address the issues each of you were separately hitting in terms of what the |
I did chapter 4 here: #4043. I think some explanation about which listings need to be converted would be helpful:
|
Thanks for the note, @jpmelos – I’ll update the issue description here. Basically, it should only be converted if it has an explicit listing number ( |
I did chapter 05 here: #4051. |
@SpectralPixel would you like me to fix up those PRs you opened and get them across the line? (No worries; I have very often been the guy who started something and then life got busy!) |
Oh, I must've forgotten to revert those few commits. Should be only one per PR, otherwise they're all ready to go. |
I'd like to help with chapter 16. |
@LifeAdventurer go for it – I’ll mark you down on the list! Thanks! |
@SpectralPixel see the PRs—they’re all currently failing; I think it’s primarily a function of line-wrapping (see my comment on #3977 for more). |
I did all the line wrapping in at most one commit per PR, could you revert these? I'm quite busy at the moment. Other than that, the PRs should be ready to go. :) |
Ah, got it—that’ll work! |
Thanks! I'll get started on it now. |
@chriskrycho While working on this, I noticed the changes in your PR #4060 for a different chapter and saw that a book/src/ch18-01-what-is-oo.md Lines 61 to 69 in 2399b90
Also, both the text book/src/ch18-01-what-is-oo.md Line 47 in 2399b90
book/src/ch18-01-what-is-oo.md Line 61 in 2399b90
Could you check if they need to be removed? If needed, I can open another pull request to fix it. |
Thanks for noting that, @LifeAdventurer – I went ahead and fixed it this morning, and am reviewing your PR for ch. 16 now! |
Glad I could help with that. Thanks for merging the PR! Let me know if there's anything else I can help with. |
Background
As of #3918, we have a preprocessor that allows us to author with a custom HTML tag,
Listing
, roughly as if it were a component in a templating language. This input:…will generate this output in the regular book (and strip all the tags in the NoStarch book):
As described in the PR adding support for this, the result is more accessible HTML, which will also give us a nice way to hook in for styling things better if we so choose.
Contributing
When converting to a
<Listing>
, you can drop the leadingListing <number>:
from thecaption
arg, since it handles that automatically with thenumber
arg.Do add a
<Listing>
for all code blocks (includingrust
,text
,console
, etc.) which have either or both of:<span class="caption">Listing XX-YY: …</span>
<span class="filename">Filename: src/main.rs</span>
Do not add a
<Listing>
for code blocks which do not have at least one or the other of those.If you’d like to help, please leave a comment below noting which chapter you’d like to pick up so folks don’t do duplicate work! If it already has a user handle by it, please don’t work on that chapter.
<Listing>
#3924)<Listing>
#3926)<Listing>
#3926)<Listing>
#4043)<Listing>
#4051)<Listing>
#3977)<Listing>
#3979)<Listing>
#3981)<Listing>
#3980)<Listing>
#3978)<Listing>
for Chapter 15 #4072)<Listing>
preprocessor for chapter 16 #4066)<Listing>
for final chapters (after restructuring) #4060)<Listing>
for final chapters (after restructuring) #4060)<Listing>
for final chapters (after restructuring) #4060)<Listing>
for final chapters (after restructuring) #4060)The text was updated successfully, but these errors were encountered: