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
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:
<Listingnumber="1-1"file-name="src/lib.rs"caption="A listing showing how to use a `Listing`">
```rustfnmain() {
println!("Hello, listing!");
}
```
</Listing>
…will generate this output in the regular book (and strip all the tags in the NoStarch book):
<figureclass="listing"><spanclass="file-name">Filename: src/lib.rs</span><pre><preclass="playground"><codeclass="language-rust">fn main() {
println!("Hello, listing!");
}</code></pre></pre><figcaption>Listing 1-2: A listing showing how to use a <code>Listing</code></figcaption></figure>
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.
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.
Note for contributors: when converting to a <Listing>, you can drop the leading Listing <number>: from the caption arg, since it handles that automatically with the number arg.
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.
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.
Note for contributors: when converting to a
<Listing>
, you can drop the leadingListing <number>:
from thecaption
arg, since it handles that automatically with thenumber
arg.The text was updated successfully, but these errors were encountered: