Altai-man / docs.raku.org

Source code of a beta version of the updated docs.raku.org website
Artistic License 2.0
11 stars 6 forks source link

not all examples should be runnable #49

Closed coke closed 2 years ago

coke commented 2 years ago

Not all examples generate output (or are intended to be standalone runnable snippets). It would be nice to be able to mark certain examples as runnable or not (depending on what we make the default).

Something like :!runnable on the example's Pod?

Altai-man commented 2 years ago

I agree and disagree on this. :)

One point to disagree is the examples are editable on the page. So say you have something like my %foo = a => 42 and it doesn't produce any output, but it's easy to inline change it to say something.

Another point is that some code code block are not examples, but serve different purposes (explaining signatures, for example).

So we have a set of rules to work out examples we're not going to execute: https://github.com/Altai-man/docs.raku.org/blob/master/lib/Docky/Renderer/Node.pm6#L32-L40

My take is we can 1)extend those rules with heuristic you think we're missing; 2)make the heuristic also support :!runnable as an explicit marker; 3)both.

What do you think?

patrickbkr commented 2 years ago

I personally tend to like having explicit rules. I understand people seem to like things to just work, so I don't oppose. But can we at least have :!runnable and :runnable so we can be explicit as a fallback?

Altai-man commented 2 years ago

I believe it's resolved with https://github.com/Altai-man/docs.raku.org/commit/53ead00803a59f1f8b991e90d04bd328d4562905