Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prism breaks JavaScript highligting using code_highligt #497

Open
Hexagon opened this issue Oct 4, 2023 · 3 comments
Open

Prism breaks JavaScript highligting using code_highligt #497

Hexagon opened this issue Oct 4, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@Hexagon
Copy link

Hexagon commented Oct 4, 2023

Version

v1.19.1

Platform

deno 1.37.1 (release, x86_64-unknown-linux-gnu)

What steps will reproduce the bug?

This could very well be a wontfix, i got here by accident... But it could be a symptom of something else going wrong:

Setup a fresh lume project, include code_highlight and prism:

@Hexagon ➜ /workspaces/lumebug (master) $ deno run -Ar https://deno.land/x/lume/init.ts
Warning Implicitly using latest version (v1.19.1) for https://deno.land/x/lume/init.ts
 ? Choose the configuration file format › _config.ts (TypeScript)
 ? Do you want to install some plugins now? › Yes
 ? Select the plugins to install › code_highlight, prism

Change _config.yaml so that prism is used before code_highlight

// ...
site.use(prism());
site.use(code_highlight());
// ...

Create index.md, include a javascript code block

# Hello Bug!

\`\`\`javascript
const a = 1;
\`\`\`

^ Had to escape the backticks, unescape them

Build site

deno task lume

How often does it reproduce? Is there a required condition?

Every time

What is the expected behavior?

Success!

What do you see instead?

Pages and pages of:

          mode: ""
        },
        [Symbol("[[webidl.brand]]")]: Symbol("[[webidl.brand]]")
      },
      _ancestors: Set(3) {
        <ref *18> HTMLDocument [EventTarget] {
          nodeName: "#document",
          nodeType: 9,
          childNodes: [NodeList],
          parentNode: null,
          parentElement: null,
          _ancestors: Set(0) {},
          head: [Element [EventTarget]],
          body: [Element [EventTarget]],
          implementation: DOMImplementation {},
          [Symbol()]: [Object],
          [Symbol("[[webidl.brand]]")]: Symbol("[[webidl.brand]]")
        },
        <ref *20> Element [EventTarget] {
          nodeName: "HTML",
          nodeType: 1,
          childNodes: [NodeList],
          parentNode: [HTMLDocument [EventTarget]],
          parentElement: null,
          _ancestors: [Set],
          tagName: "HTML",
          localName: "html",
          attributes: NamedNodeMap {},
          [Symbol()]: [Object],
          [Symbol("[[webidl.brand]]")]: Symbol("[[webidl.brand]]")
        },
        <ref *15> Element [EventTarget] {
          nodeName: "BODY",
          nodeType: 1,
          childNodes: [NodeList],
          parentNode: [Element [EventTarget]],
          parentElement: [Element [EventTarget]],
          _ancestors: [Set],
          tagName: "BODY",
          localName: "body",
          attributes: NamedNodeMap {},
          [Symbol()]: [Object],
          [Symbol("[[webidl.brand]]")]: Symbol("[[webidl.brand]]")
        }
      },
      tagName: "PRE",
      localName: "pre",
      attributes: NamedNodeMap {},
      [Symbol()]: {
        assignedSlot: false,
        hasActivationBehavior: false,
        host: null,
        listeners: [Object: null prototype] {},
        mode: ""
      },
      [Symbol("[[webidl.brand]]")]: Symbol("[[webidl.brand]]")
    }
  },
  tagName: "CODE",
  localName: "code",
  attributes: NamedNodeMap {},
  [Symbol()]: {
    assignedSlot: false,
    hasActivationBehavior: false,
    host: null,
    listeners: [Object: null prototype] {},
    mode: ""
  },
  [Symbol("[[webidl.brand]]")]: Symbol("[[webidl.brand]]")
}

Additional information

No response

@Hexagon Hexagon added the bug Something isn't working label Oct 4, 2023
@Hexagon Hexagon changed the title Prism breaks JavaScript highligting Prism breaks JavaScript highligting using code_highligt Oct 4, 2023
@oscarotero
Copy link
Member

Hmm, why are you using prism and code_highlight? Both plugins are mutually exclusive because they do the same things but with different libraries.

@Hexagon
Copy link
Author

Hexagon commented Oct 5, 2023

Yes, it was by accident, but it took way to long to figure out what was going wrong as i didn't get any clue from the error message.

Maybe a warning if they both are activated at the same time, if someone else is careless enough to activate them both? :)

@oscarotero
Copy link
Member

Ah, ok, got it.
Good idea, I'll think something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants