Nunjucks filters in Highlight template throws Template render error
See original GitHub issueThank you for creating this plugin, much appreciated.
I’m trying to use Nunjucks filter ‘replace’ in the Highlight template,
{{ text | replace('4', '.') }}
{% if note %}{{note}}{% endif %}
---
But it results in template render error,
Error parsing
.../My clippings.txt.
Template render error:(unknown path)
TypeError: Cannot read property 'lineno' of undefined
My actual goal is to use regex with the replace filter, But since it didn’t work I tried a basic replace as sighted above.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:16 (8 by maintainers)
Top Results From Across the Web
nunjucks templating docs
Filters are essentially functions that can be applied to variables. ... It might be useful to not throw an error if a template...
Read more >node.js - find which template file causes "template render error"
1 Answer 1 · filename -> absolute path to the file causing the error · tmplStr -> all the contents of that file...
Read more >WebC — Eleventy
Using Eleventy's built-in Render plugin allows you to render WebC inside of an existing Liquid, Nunjucks, or 11ty.js template. View this example in:...
Read more >CHANGELOG.md | lume@v0.22.6 - Deno
The format is based on Keep a Changelog, and this project adheres to Semantic ... Updated nunjucks (a new fork) and highlight.js ....
Read more >Four Killer Features of Nunjucks | CSS-Tricks
This is meant to be run in Node.js and used to compile templates server ... showing me run a Node script that renders...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
So that we can confirm if the original issue that you had raised was resolved by the last release, you can bypass the validation that the plugin uses and modify the plugin’s
data.json
file directly. Simply sethighlightTemplate
to the nunjucks template that you want and it should be picked up by the plugin.I’ll look into fixing the false negative issue of validation after I am done with another task.
Thanks for raising this @abishekmuthian. I understand this issue and it is a valid bug.
To support resync, the plugin adds a “block reference” (e.g.
^ref-1233
) at the end of a highlight (rendered using{{ text }}
tags in nunjucks). The plugin has not catered for the fact that you could be using a nunjucks modifier such asreplace
to manipulate the content.Will fix shortly.