Skip to content

Added the capability to Replace the Header with PATCH. #168

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

taylor-hutyra
Copy link

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.

… while replacing text instead of only the text after the header. Set Replace-Heading to true in the API call to replace header. False or undefined will do a standard replace
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.

1 participant