Skip to content

Set Prism.manual = true to prevent unnecessary code execution #6745

@JaKXz

Description

@JaKXz

Originally posted in #6688 (comment)

Here are Prism's docs on the issue: https://prismjs.com/#basic-usage and a bit longer explanation in source

TLDR Prism has a legacy assumption that you're going to render your code statically and so it calls its highlightAll method under the hood to replace everything with the tokenized spans after JS has loaded. I think it searches for elements matching the .prism-code selector, so that's probably why it hasn't been noticed but the code is still being executed unnecessarily.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions