This is intended to be a markdown parser that I can use to pass a string to and get a nice, html, highlighted file. WIP
const loremFetcher = async (id: string) => {
const ipsum = await fetch(`.../${id}`);
const text = await ipsum.text();
return text;
};
Becomes: YGBgdHlwZXNjcmlwdApjb25zdCBsb3JlbUZldGNoZXIgPSBhc3luYyAoaWQ6IHN0cmluZykgPT4gewogIGNvbnN0IGlwc3VtID0gYXdhaXQgZmV0Y2goYC4uLi8ke2lkfWApOwogIGNvbnN0IHRleHQgPSBhd2FpdCBpcHN1bS50ZXh0KCk7CiAgcmV0dXJuIHRleHQ7Cn07CmBgYA==
And the request:
curl -X GET -G 'http://...?text=YGBgdHlwZXNjcmlwdApjb25zdCBsb3JlbUZldGNoZXIgPSBhc3luYyAoaWQ6IHN0cmluZykgPT4gewogIGNvbnN0IGlwc3VtID0gYXdhaXQgZmV0Y2goYC4uLi8ke2lkfWApOwogIGNvbnN0IHRleHQgPSBhd2FpdCBpcHN1bS50ZXh0KCk7CiAgcmV0dXJuIHRleHQ7Cn07CmBgYA==`
Returns this html text, hich would look like this:
POST
request gets more options. Request payload (application/json
):
{
"content": "# Testing md to html with snytax highlighting:\n```\nconst loremFetcher = async (id: string) => {\n const ipsum = await fetch(`.../${id}`);\n const text = await ipsum.text();\n return text;\n};\n```",
"options": {
"return_type": "html", // or "text"
"font": true, // default: true
"syntax_highlight": true // default: true
// WIP: "extensions": ["gfm", "strikethrough", "typographer", ...]
}
}
Returns: