Skip to content

Option to leave code with unsupported language untouched #210

@MarkusWendorf

Description

@MarkusWendorf

Hello, and thanks again for all the work.

I have a private rehype plugin that relies on code blocks with a specific language to be set (think bla-bla-blub, more like a private api). It also relies on the fact that these code blocks are not manipulated by remark plugins (expecting a specific node/tree structure).

Right now a warning is displayed for unsupported languages, but the transform is happening regardless (with lang=text).

I would like to have the option to disable this behaviour and not do any transformations on unsupported languages.

Another option would be to not highlight unsupported languages and tell the user to use lang=text.

console.warn(
"[Code Hike warning]",
`${lang} is not a valid language, no syntax highlighting will be applied.`
)
return highlight({ code, lang: "text", theme })

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