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

CWL examples could have better syntax highlighting #262

Open mr-c opened 1 year ago

mr-c commented 1 year ago

Sphinx uses pygments for code highlighting

https://pygments.org/docs/lexerdevelopment/

(see also https://github.com/common-workflow-language/common-workflow-language/issues/784 )

smyja commented 1 year ago

Sphinx uses pygments for code highlighting

https://pygments.org/docs/lexerdevelopment/

(see also common-workflow-language/common-workflow-language#784 )

I noticed yaml is currently used as the lexer in the guide, @kinow picked it. Are you suggesting a new lexer is created for pygments?

mr-c commented 1 year ago

Sphinx uses pygments for code highlighting https://pygments.org/docs/lexerdevelopment/ (see also common-workflow-language/common-workflow-language#784 )

I noticed yaml is currently used as the lexer in the guide, @kinow picked it. Are you suggesting a new lexer is created for pygments?

Yes, we need a better lexer to distinguish between CWL keywords and user supplied names and values

smyja commented 1 year ago

Sphinx uses pygments for code highlighting https://pygments.org/docs/lexerdevelopment/ (see also common-workflow-language/common-workflow-language#784 )

I noticed yaml is currently used as the lexer in the guide, @kinow picked it. Are you suggesting a new lexer is created for pygments?

Yes, we need a better lexer to distinguish between CWL keywords and user supplied names and values

Okay, I'll create a repo and tag you to review once I'm done before creating a pr in the pygments repo.

swzCuroverse commented 1 year ago

So this seems to be doable -

swzCuroverse commented 1 year ago

@Mackenzie-OO7 is going to work on this.

kinow commented 1 year ago

Everything sounds right to me @swzCuroverse . Great job with the action plan! I did not have time, so I just used YAML. But it is definitely a very interesting task to anyone interested in programming (and compilers, interpreters, programming languages, and so on).

Mackenzie-OO7 commented 1 year ago

So this seems to be doable -

Hi, I ran into an issue while trying to convert the vim plugin. When I try to generate the css file by running ./pygmentize -S cwl -f html -a .highlight > cwl.css I get the error: /usr/bin/env: ‘python2’: No such file or directory

kinow commented 1 year ago

Looks like the version of pygmentise you are using needs Python 2. Some software older than a few years might have a Python 2 version, but also a newer Python 3. You need to confirm the version you have installed and try to update to a newer version, if available.

If you are using the instructions from https://github.com/honza/vim2pygments, I see one of their commits from 9 years ago has this message "make it work with python 3+". So it should work.

Mackenzie-OO7 commented 1 year ago

Looks like the version of pygmentise you are using needs Python 2. Some software older than a few years might have a Python 2 version, but also a newer Python 3. You need to confirm the version you have installed and try to update to a newer version, if available.

If you are using the instructions from https://github.com/honza/vim2pygments, I see one of their commits from 9 years ago has this message "make it work with python 3+". So it should work.

I have Python 3 installed. Yup, I'm following the instructions from https://github.com/honza/vim2pygments, and I got that error.

swzCuroverse commented 1 year ago

In looking forward - it looks like this might just create a style instead of a lexer that is needed. Let me do a little more research - although the style might be useful.