Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax-highlight comments in verso code #274

Open
eric-wieser opened this issue Jan 17, 2025 · 1 comment
Open

Syntax-highlight comments in verso code #274

eric-wieser opened this issue Jan 17, 2025 · 1 comment

Comments

@eric-wieser
Copy link

It would be great if a dedicate span tag was placed around -- and /- comments within a lean code snippet.

In https://storage.googleapis.com/deepmind-media/DeepMind.com/Blog/imo-2024-solutions/P2/index.html, I hacked around this with

            .hl.lean {
                color: #c92786
            }

            .hl.lean > * {
                color: black
            }

This might also align with future work to exploring rendering markdown and latex inside comments.

@david-christiansen
Copy link
Collaborator

This would absolutely be useful.

How would this structure work:

-- foo

becomes something along the lines of

<span class="comment line"><span class="delimiter">--</span> foo</span>

and

/- stuff /- nested -/
 -/

becomes

<span class="comment block"><span class="delimiter">/-</span> stuff /- nested -/
 <span class="delimiter">-/</span></span>

?

Also, it seems like it could be good to be able to parameterize the highlighting routines with a "comment handler" that transforms comments into something else. This would unlock Verso-enabled literate Lean, and many other interesting use cases, and might be nicer than doing it in post-processing (e.g., the source code info trees could be available in the handlers). Any thoughts on how to make it useful for you too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants