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

Code formatting reports unknown language for plaintext #269

Closed
girlpunk opened this issue Jun 15, 2023 · 6 comments
Closed

Code formatting reports unknown language for plaintext #269

girlpunk opened this issue Jun 15, 2023 · 6 comments
Labels
General Enhancement New feature or request

Comments

@girlpunk
Copy link

As per highlight.js's supported languages, plaintext is a valid language for highlighting, however Statiq reports a warning when using this

[WARN] Content/PostProcess » RenderContentPostProcessTemplates » ExecuteIf » ExecuteConfig » HighlightCode » Exception while highlighting source code: Error: Unknown language: "text"
   at highlight-all.js:498:7
@daveaglick
Copy link
Member

The version of highlight.js Statiq uses for generation-time highlighting is relatively old and required some workarounds to build so it could be run from inside .NET: https://github.com/statiqdev/Statiq.Framework/blob/main/src/extensions/Statiq.Highlight/regenerating-highlight-all.js.md. I took a quick look through the code and sure enough, txt, plaintext, and text are all not current aliases. Those may have been added after our internal copy was produced.

I can see about updating our version of highlight.js.

@daveaglick daveaglick added the General Enhancement New feature or request label Jun 15, 2023
@daveaglick
Copy link
Member

Unfortunately it wasn't as easy as just running the same commands I used initially. As often happens, the npm packages and node ecosystem has moved under us and I'll need to figure out how to regenerate the highlight.js file from scratch. That could take some time.

@girlpunk
Copy link
Author

If it helps, it looks like there's a special case to handle plaintext, which should be getting detected at highlight-all.js:623

@daveaglick
Copy link
Member

It took a little hacking, but I got this figured out. Highlighting txt should work in the next release of Statiq (probably next week some time).

@girlpunk
Copy link
Author

girlpunk commented Sep 5, 2023

Hi, any chance on a release for this? Thanks

@daveaglick
Copy link
Member

A new release just went out! Sorry for the super-long delay. I had thought I released this already and then got swamped (still am, but managed to get a new release out the door).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
General Enhancement New feature or request
Development

No branches or pull requests

2 participants