Skip to content

Could we get a way to use user-provided highlight.js definitions instead of just the standard ones? #8

Description

@haltman-at

So, I want to use chromafi to provide highlighting for Solidity. Now, Solidity is not presently in highlight.js (it likely soon will be, but I don't know how soon, and I have good reason to want this quickly and not have to wait there).

Fortunately, I can highlight Solidity with highlight.js by means of the highlightjs-solidity project, allowing me to register Solidity with my hljs object. Unfortunately, I have no way to use this in chromafi, since chromafi doesn't allow using a custom hljs object that might have additional languages registered.

I see two possible ways of remedying this:

  1. Provide some way for the user to pass in a custom hljs object, on which they might have registered additional languages (or made other changes -- maybe they want custom highlighting for one of the standard languages!).
  2. Don't allow that, but instead expose as exports some of what are currently purely internal functions, so that the user can, on their own, use their custom hljs object to get the XML-based highlighting, and then can pass the result into these lower-level functions you've now exposed, to achieve the same result.

(And maybe there's some other way I've failed to think of.)

In any case, any way of allowing the user to not be limited to hljs's current built-in languages would be appreciated. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions