Skip to content

Allow users to customize the Markdown highlighter code #1412

Closed
@hegemonic

Description

@hegemonic

For code snippets, jsdoc/util/markdown applies a specific set of classes to the HTML tags. This approach only works if the template is using Google Code Prettify for syntax highlighting. We should allow users to override the built-in highlighter function so that it's possible to use other syntax highlighters and highlight code at the time the docs are generated.

There are a few ways we could implement this feature:

  • Allow the user to specify a highlight function in a JS config file. This forces people to use a JS config file (but maybe that's not a bad thing).
  • Allow the user to specify the location of a module that exports a highlighter function. This would be more cumbersome than the previous approach, but it would work with JSON config files. We could do this in conjunction with the previous approach.
  • Allow the user to specify a format string for the code wrapper. This is probably not flexible enough.
  • Allow the template to export a highlight function. This would require JSDoc to load the template before it could do anything Markdown-related, so this is a non-starter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions