common-workflow-language / user_guide

The CWL v1.0 - v1.2 user guide
http://www.commonwl.org/user_guide/
Other
42 stars 67 forks source link

runcmd directive doesn't work with emphasize-lines #269

Closed kinow closed 2 years ago

kinow commented 2 years ago

We use emphasize-lines to highlight certain lines of our code blocks. This way we can highlight the first line (emphasize-lines: 0), multiple discrete lines (emphasize-lines: 0, 3, 10), or ranges (emphasize-lines: 0, 3-10, 12, 20-21).

That works with code-block, but apparently it's not working with runcmd: https://github.com/common-workflow-language/user_guide/pull/246#discussion_r991056786 (cc @mr-c).

Note that we have copied the code from the original runcmd since we needed a few modifications to support running our CWL examples in an isolated Docker environment consistently.

In both the original, and in our version of runcmd, the runcmd directive extends CodeBlock. This means that the final rendered output **is a code-block, and it supports emphasize-lines.

However, you should see some warnings saying that it couldn't locate lines above number 0, I think. That's because I believe runcmd is trying to highlight lines for an output line {runcmd} cwltool test.cwl, instead of using the rendered output (i.e. {code-block} cwltool version etc.\ncommand-output lines, etc…..

If this is confirmed, it shouldn't be too hard to change the order somehow to make runcmd to evaluate the command first, and only then use the emphasize-lines option. Unless the only way of doing it requires changes to the code-block directive Python object itself (hopefully not).

Cheers -Bruno

swzCuroverse commented 2 years ago

For my version of sphinx it errors on this, not a message. So, it is impossible to build in the current condition. I get -- /home/swz/user_guide/src/topics/inputs.md.rst:222:line number spec is out of range(1-1): '3, 9-10, 24' make: *** [Makefile:50: html] Error 2

kinow commented 2 years ago

Huh I will try updating my dependencies too and test it. Thanks for reportingit @swzCuroverse !