-
Notifications
You must be signed in to change notification settings - Fork 373
Don't overwrite but merge keys for pandoc #13353
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
base: main
Are you sure you want to change the base?
Don't overwrite but merge keys for pandoc #13353
Conversation
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
After simplifying the mechanism to also handle arrays, some examples with evaluated entries break, but at this point I can't tell anymore how this is supposed to work at all :) |
Merging is supposed to be behavior we use, but We are working on fixing some things that will (fix some things that will)* eventually let us reason more precisely about the behavior of YAML configuration. Stay tuned for the behavior of YAML blocks in our new markdown variant! |
This problem is not limited to I would appreciate if we could find a quicker intermediate solution than a full overhaul of the markdown parsing system. (The parsing is also not the problem here, all attributes are correctly merged and available at first, and then some info is thrown away). As you say, there are too many special keys, so the only way to avoid problems seems to be to namespace all custom keys under one key that's unlikely to conflict with anything quarto might add. But this you cannot do due to this overwriting bug. |
Do you have an MWE of this happening outside of |
The MWE I posted contains both, params and no params. Consider the entry |
We are about to release 1.8 (hopefully tomorrow), so this isn't a PR we can merge right now. But I agree that we should try to do a faster fix early in 1.9 (the bigger changes I'm alluding to will start coming in at 1.9 as well) |
Description
This PR fixes an issue I noticed when writing a typst template that was supposed to use metadata defined under the
params
key, so that both the template and some julia code in the notebook could inspect the relevant values. I could not access values defined in_quarto.yml
and first thought it was an issue aboutparams
itself, which turned out not to be the case.Here's a repo where I pushed an MWE with a basic qmd file and typst template https://github.com/jkrumbiegel/quarto-mwe-pandoc-metadata
When rendering this with quarto, I got the following result:
You can see that only the data from
_quarto.yml
that does not share keys with the file's frontmatter actually reaches the template. I logged two relevant bits of data frompandoc.ts
and you can see that this would be the behavior when replacing the first object's keys with those present in the second object:I don't really understand what problem the code that does the overwriting was supposed to solve, but I thought if data from the
engineMetadata
is needed, maybe we should at least just merge it in, not overwrite. I assume the nested case was not considered when writing this.With the change from this PR, I get the following render:
I need help in adding a minimal test, as the MWE I have seems too extensive and a more targeted unit test might be better suited.
I would also ask for this fix to be considered for backporting to 1.7, as we cannot update to the 1.8 series quickly and the extent of the fix is very small while its impact is larger.
Checklist
I have (if applicable):