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
Lines in a code block starting with a hash (#) are hidden by mdbook, which is generally good for hiding lines that are irrelevant while still allowing doctests/playground runs to build. However, this clashes with Rune object literals, which also start with a hash. This can be seen in the last example of the Pattern Matching chapter.
The example displays as:
fndescribe_car(car){match car {
_ => "Can't tell 😞",}}fnmain(){println(describe_car(#{"model":"Ford","make":2000}));println(describe_car(#{"model":"Honda","make":1980}));println(describe_car(#{"model":"Volvo","make":1910}));}
with the output
$> cargo run -- scripts/book/pattern_matching/fast_cars.rn
Pretty fast!
Can't tell 😞
What, where did you get that?
== () (5.3533ms)
...which doesn't make very much sense, until you view the source file:
fn describe_car(car){match car {
#{"make": year, ..}if year < 1950 => "What, where did you get that?",
#{"model":"Ford","make": year, ..}if year >= 2000 => "Pretty fast!",
_ => "Can't tell 😞",}}fnmain(){println(describe_car(#{"model":"Ford","make":2000}));println(describe_car(#{"model":"Honda","make":1980}));println(describe_car(#{"model":"Volvo","make":1910}));}
The text was updated successfully, but these errors were encountered:
PatchMixolydic
changed the title
Lines starting with an object are hidden by mdbook
Lines starting with an object literal are hidden by mdbook
Sep 6, 2020
I'm... not sure how to fix it. Maybe it's possible to disable by adding a custom syntax? Would be great if someone more familiar with mdbook could help out!
mdBook itself has a demonstration of the hash-hiding syntax in their book, and they seem to use Bash highlighting to get around this issue. It's not a great fix, but it's at least a workaround.
Lines in a code block starting with a hash (#) are hidden by mdbook, which is generally good for hiding lines that are irrelevant while still allowing doctests/playground runs to build. However, this clashes with Rune object literals, which also start with a hash. This can be seen in the last example of the Pattern Matching chapter.
The example displays as:
with the output
...which doesn't make very much sense, until you view the source file:
The text was updated successfully, but these errors were encountered: