I am using the command x-devonthink://createHTML
and use three parameters being title
, source
and location
.
According to the documentation the meaning of these parameters is:
Parameter | Meaning |
---|---|
title | The title of the item to be created (string). |
source | he HTML content for HTML documents (string, only used by createHTML and createFormattedNotes ). |
location | The URL linking to the content, e.g., the URL of the website for the bookmark (URL). |
So far so good. For testing purposes I have the title New HTML
and as the source I am using the following HTML:
<html lang="en">
<header>
<meta charset="UTF-8">
<title>New html</title>
</header>
<body>
<p>This is a test HTML document created for DEVONthink.</p>
</body>
Then finally for the location I have two variants being:
- https://discourse.devontechnologies.com/t/how-to-use-a-url-command-outside-the-browser/74563/3
- https://www.example.com/test.html
The title, location and source are all URL encoded.
I call the URL using the format:
x-devonthink://createHTML?title=<encoded title>&source=<encoded source>&location<encoded location>
When the encoded location is the first URL, i.e. the URL pointing to devon technologies, the article that is created will have the content of the page the location is pointing at, so the content of the URL. The HTML that was send using the source parameter is ignored. The location is properly stored. The title is as expected.
Then I repeat this command with the second URL, being the example domain. The article that is created will have the HTML as specified in the source. The location is properly stored. The title is as expected
When I repeat the command without a location, I hear a beep and no explanation why it fails.
This leads me to a couple of questions:
- What exactly is
source
used for. Under what circumstances is it ignored? - How do
source
andlocation
relate? - Why is the behavior different for the given URL’s.
- Why is the location mandatory if you save HTML. Not all HTML has a URL
BTW, I am using the latest 4.0.2 release.
For reference I am listing the complete URL’s below:
For URL 1, devon technologies
x-devonthink://createHTML?title=New%20html&location=https://discourse.devontechnologies.com/t/how-to-use-a-url-command-outside-the-browser/74563/3&source=%3Chtml%20lang=%22en%22%3E%0A%3Cheader%3E%0A%3Cmeta%20charset=%22UTF-8%22%3E%0A%3Ctitle%3ENew%20html%3C/title%3E%0A%3C/header%3E%0A%3Cbody%3E%0A%3Cp%3EThis%20is%20a%20test%20HTML%20document%20created%20for%20DEVONthink.%3C/p%3E%0A%3C/body%3E
For URL to example.com
x-devonthink://createHTML?title=New%20html&location=https://www.example.com/test.html&source=%3Chtml%20lang=%22en%22%3E%0A%3Cheader%3E%0A%3Cmeta%20charset=%22UTF-8%22%3E%0A%3Ctitle%3ENew%20html%3C/title%3E%0A%3C/header%3E%0A%3Cbody%3E%0A%3Cp%3EThis%20is%20a%20test%20HTML%20document%20created%20for%20DEVONthink.%3C/p%3E%0A%3C/body%3E