Skip to content

Make the SyntaxHighlighterBase.$format method easily accessible to syntax highlighters #1220

@djencks

Description

@djencks

Currently a javascript syntax highlighter format method has to do this to call the 'superclass method':

const toHash = function (object) {
  return object && !object.$$is_hash ? Opal.hash2(Object.keys(object), object) : object
}
return Opal.send(this, Opal.find_super_dispatcher(this, 'format', this.$format), [node, lang, toHash(opts)])

It would be considerably more convenient, and avoid the need to import Opal, if this could be hidden in the superclass/adapter so one could write:

this.super.format(node, lang, opts)

https://gitlab.com/djencks/asciidoctor-highlight.js-build-time could provide a test case.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions