Added the capability to Replace the Header with PATCH. #168
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.
not alot going on here. Just an optional parameter through the API call into _vaultPatchV3 with a check that it is equal to true.
const replaceHeading = req.get("Replace-Heading") == "true";
Undefined defaults to false.
This get's passed on through the PatchInstruction object.
New Example Curl:
curl -X 'PATCH'
'http://127.0.0.1:27123/vault/Simple%20Note.md'
-H 'accept: /'
-H 'Operation: replace'
-H 'Target-Type: heading'
-H 'Target-Delimiter: ::'
-H 'Target: This is a super simple note::Updating the Header'
-H 'Trim-Target-Whitespace: true'
-H 'Authorization: Bearer cc64dd3f42437913877c8c942e53b34fb7868def6318aab360d0f586a1087ae5'
-H 'Content-Type: text/markdown'
-H 'Replace-Heading: true'
-d '## New Test Header
Updating header and text
'
Notice the newline between the Header and the Content.
OF NOTE: The package.json currently sets the dependency of markdown-patch to my forked version so that you can test it without accepting the markdown-patch changes first.
If all is well, it needs to updated to point back to the npm version.