fix quotes in titles breaking graph json output #400
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
resolves: #389
note titles with
"
marks in them, egthis is an "example" title
, are breaking the output ofzk graph --format json
.The culprit is the template for the json format. I can't exactly track down where that is set, but it would seem deeper from
internal/core/notebook.go:336
.In any case, this fix manually sanitizes the quote marks as they're being returned to the
Link
field, for output to json. Link output within documents (i.e, inserting wiki/markdown links in documents is not broken as that is handled separately ininternal/core/link_format.go
).The caveat is that this fix breaks an old tesh test that looks at json output.
However, it would seem that the old tesh test is not taking into account note titles with
"
marks.Therefore, the failing test may be a sign of the test needing to be updated, rather than this fix being void?
In any case, this initial commit to the PR is effectively a draft. I'm looking for feedback about the above!
There is also [a discussion] in a previous issue which shows the development of the graph output, and also that quotes in the titles are breaking its output