Skip to content

Conversation

kevinushey
Copy link
Contributor

Closes #813.

@cscheid
Copy link
Contributor

cscheid commented Sep 5, 2025

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.

@vezwork
Copy link
Collaborator

vezwork commented Sep 5, 2025

@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!

@juliasilge juliasilge requested a review from vezwork September 9, 2025 16:05
@vezwork
Copy link
Collaborator

vezwork commented Sep 9, 2025

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('=');
Copy link
Contributor Author

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 =?

Copy link
Collaborator

@vezwork vezwork Sep 9, 2025

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 }

Copy link
Collaborator

@vezwork vezwork left a 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.

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.

support '=' in key=value pairs
3 participants