Save HTML body as a markdown file (md) in Google Drive
Submit your an HTML body with the following parameters:
title
data
url
tags
(optional)The resulting markdown file will have a filename of title
with the markdown-ified HTML body as its content. The content will be embedded with a link the url
tag.
If you wish to add tags, you can supply a tags
field with a comma-delimited string like so: tech,engineering,programming
. The markdown content will be embedded with the tags: #tech #engineering #programming
right below the link of the source.
I use a bookmarklet of to trigger the submission to the endpoint. Something like this will work:
javascript:(function()
{
var tags = prompt("Enter relevant tags for the article:","");
var form = document.createElement('form');
form.style.visibility = 'hidden';
form.method = 'post';
form.action = '<link to the HTTP endpoint>';
form.target = 'response';
inputTitle = document.createElement('input');
inputTitle.name = 'title';
inputTitle.value = document.title;
form.appendChild(inputTitle);
inputTags = document.createElement('input');
inputTags.name = 'tags';
inputTags.value = tags;
form.appendChild(inputTags);
inputUrl = document.createElement('input');
inputUrl.name = 'url';
inputUrl.value = window.location.href;
form.appendChild(inputUrl);
dataTitle = document.createElement('input');
dataTitle.name = 'data';
dataTitle.value = document.querySelector('*').outerHTML;
form.appendChild(dataTitle);
document.body.appendChild(form);
form.submit();
}
)();