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

highlight.js occasionally does not highlight Haskell/Nix code blocks when editing #463

Open
tmoux opened this issue Nov 30, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@tmoux
Copy link

tmoux commented Nov 30, 2023

Describe the bug
When editing a page with a Haskell/Nix/any non-default-highlight.js language code block, syntax highlighting will occasionally break.
When this happens, the following warning is displayed in the browser console:

WARN: Could not find the language 'haskell', did you forget to load/include a language module?
WARN: Falling back to no-highlight mode for this block. 

The issue is fixed whenever the page is reloaded, or by calling hljs.highlightAll() in the console.
Additional edits will sometimes fix the problem, sometimes not.

To Reproduce
Steps to reproduce the behavior:

  1. Download the emanote-template and start the server.
  2. Add the following code block to Tutorials/Slug.md:
```haskell
data Foo = A | B
```
    1. Add/remove lines of text. It may take several edits for the highlighting to stop working. I find that adding a new line of text and then deleting it frequently causes the error.
    2. Alternatively, refresh the page several times until the highlighting breaks.

Expected behavior
Code blocks should be correctly highlighted whenever the page is being edited.

Screenshots

Screenshot 2023-11-30 at 2 24 42 PM

Desktop (please complete the following information):

  • Browser: Firefox 120.0.1
  • emanote 1.2.0.0

Additional context

The problem seems to only occur with languages that are not included by default in highlight.js. As seen in the screenshot, the syntax highlighting for the yaml code block never breaks.
I tried updating the version of highlight.js to 11.9.0, but this had no effect.

@tmoux tmoux added the bug Something isn't working label Nov 30, 2023
@srid
Copy link
Owner

srid commented Nov 30, 2023

Aside: another case for #337 I suppose ...

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