out-of-cheese-error / gooseberry

A command line utility to generate a knowledge base from Hypothesis annotations
Apache License 2.0
152 stars 9 forks source link

How would I URL encode my highlights' text? #103

Closed Ninjani closed 7 months ago

Ninjani commented 8 months ago

Discussed in https://github.com/out-of-cheese-error/gooseberry/discussions/100

Originally posted by **daraul** September 22, 2023 I transfer my annotations into org-mode with the template below. How would I go about URL encoding `this` in the `ROAM_REFS` property? Think of javascript's `encodeURIComponent`. ```toml annotation_template = ''' {{#each highlight}}** {{this}} {{#each ../tags}}:{{this}}{{#if @last}}:{{/if}}{{/each}} :PROPERTIES: :ANNOTATION_ID: {{../id}} :ROAM_REFS: [[{{../uri}}#:~:text={{this}}]] :CREATED: {{date_format "%c" ../created}} :END: {{../text}} {{/each}} ''' ```