-
Notifications
You must be signed in to change notification settings - Fork 124
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
Add support for setting & importing variables via Nunjucks syntax into global variables #2302
Comments
Hello, currently I could think of two methods: Method 1: Prepend Pros:
Cons:
Method 2: Create our own parser to parse nunjucks tags in Pros:
Cons:
|
@tlylt I'd like to work on this issue |
Hi James, I'm not particularly confident of either of the solutions you suggested. I was thinking it might be possible to simply enable the nunjuncks processing, just like how other regular pages allow for nunjuncks syntax. Something like that. If you are available I would like you to work on #2364 which is more urgent than this issue 🙏 |
Right, I have been reading up on possible ways to do so but unfortunately I don't think there is currently a way to process templates globally. The good thing about
Alright, will be working on this 👍 |
Hi, I would like to share my findings and experiments here for future developers: Approach 1:Use eg.
Challenges: For example, we have an array
With the challenges above, we need to find another way to precisely extract the value and the data type of the variables before passing into Notes:
Approach 2:Prepend the content of
Notes:
Additional Notes: |
Please confirm that you have searched existing issues in the repo
Yes, I have searched the existing issues
Any related issues?
#2283
What is the area that this feature belongs to?
Author Usability
Is your feature request related to a problem? Please describe.
{% set/import/... %}
(nunjucks) not supported in_markbind/variables.md
:<variable>
syntax to set variables. This is ok but inconsistent with the overall use of{% set %}
to define variables.{% ext studentScoreboard = "userGuide/syntax/extra/scoreboard.json" %}
to import a json file into the globally defined variables. This is supported at the page level: https://markbind.org/userGuide/reusingContents.html#importing-variables-from-other-external-file-formatsDescribe the solution you'd like
Support
{% set/import/... %}
(nunjucks) in_markbind/variables.md
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: