Skip to content

add Extempore support to hljs #1

@benswift

Description

@benswift

Ok, here we go. This'd be super nice.

The best place to start would be with the XtlangLexer I wrote for Pygments:

https://bitbucket.org/birkenfeld/pygments-main/src/7941677dc77d4f2bf0bbd6140ade85a9454b8b80/pygments/lexers/lisp.py?at=default&fileviewer=file-view-default#lisp.py-2420

Most of the regexes could just be copy-pasted into the hljs version (although there may be some edge cases which need to be fixed up).

Then, it's just a matter of following the hljs docs for adding a new language. I've made a (very small) start with this repo, but feel free to even start from scratch (i.e. from hljs mainline if you'd prefer).

After that, the main trick with syntax highlighting for Extempore is to make sure that both the Scheme code and the xtlang code look ok. The stack-based highlighting approach of highlight.js (and Pygments, for that matter) does make this easier in some ways - look at the way the XtlangLexer does it in the Pygments link above.

If you need a few simple test cases for different syntactical things which can be tricky, have a look at the bottom of the tests/core/xtlang.xtm file in the main Extempore repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions