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

Fix nunjucks view syntax #579

Merged
merged 4 commits into from
Apr 29, 2020
Merged

Conversation

levito
Copy link
Contributor

@levito levito commented Apr 24, 2020

This makes view panels render templates with the following file extensions in Django mode (official replacement mode for Nunjucks): .nunjucks, .nunjs,. .nunj, .njk, .nj, .jinja, .jinja2, .j2

It removes the langMap from src/core/highlighter.js which worked inconsistently and moves the mapping logic to src/core/utils.js. This makes it work consistently and prevents warnings when using Nunjucks and running fractal or doing a static export.

default:
return fang(filePath) || {
name: name,
mode: 'text',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the issue we're having here, Highlight.js now requires this to be plaintext.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll have a look at this tomorrow.

fang 2.0.0 has a different return without `mode` field which is expected
by fractal. This would require more changes.
@mihkeleidast
Copy link
Member

LGTM, but let's wait for @LeBenLeBen to take a look at it again :)

@levito
Copy link
Contributor Author

levito commented Apr 29, 2020

@LeBenLeBen could you please take a look and merge if this is fine for you?

Copy link
Member

@LeBenLeBen LeBenLeBen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good, it properly highlights Nunjucks syntax and the warning about text reported in #576 is now gone!

@LeBenLeBen LeBenLeBen merged commit 30ee23a into frctl:master Apr 29, 2020
@LeBenLeBen
Copy link
Member

LeBenLeBen commented Apr 29, 2020

Thank you @levito 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants