-
Notifications
You must be signed in to change notification settings - Fork 43
allow '=' in values of pandoc key=value pairs #814
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?
allow '=' in values of pandoc key=value pairs #814
Conversation
Thanks for the PR! We need to be super careful with stuff like this - not that pandoc_attr.ts is particularly careful, but I don't want to make situation worse. I think I'd want some tests around this behavior so we don't regress on it, but also understand the blast radius of the change. |
@cscheid and @kevinushey the current tests (which did pass on CI) do provide some decent coverage on this. It would be great to add some roundtripping snapshot tests (.e.g https://github.com/quarto-dev/quarto/pull/790/files) that more explicitly capture the new behaviour though! |
Thanks for adding tests @kevinushey!! Gonna take a look at this. |
@@ -311,8 +311,10 @@ export function pandocAttrKeyvalueFromText(text: string, separator: ' ' | '\n'): | |||
|
|||
const lines = text.trim().split('\n'); | |||
return lines.map(line => { | |||
const parts = line.trim().split('='); | |||
return [parts[0], (parts[1] || '').replace(/^"/, '').replace(/"$/, '')]; | |||
const idx = line.indexOf('='); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realized post-hoc that I should probably check if the line here actually has an =
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea I suppose so! like if (idx === -1) return [line, '']; else { bla }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
attr-equals.qmd
is quite extensive! Nice. Perhaps it could also contain some lines of prose/markdown that contain equals symbols? Not sure if that could cause issues or not.
Also, could you add a description of the fix to https://github.com/quarto-dev/quarto/blob/main/apps/vscode/CHANGELOG.md under 1.125.0 please?
Looks great otherwise! Excited to have this fix! The test makes me pretty confident that this works well!
Please squash and merge once the PR is ready.
Closes #813.