4 ms·
I'm skeptical of Markdown as the only, best practice, option. I've been searching for this online - can I make an API call from Markdown? - and this is one of t
by julianeon 6y ago
I'm skeptical of Markdown as the only, best practice, option. I've been searching for this online - can I make an API call from Markdown? - and this is one of those cases where common search terms make it hard to narrow down the result. However, a cursory search makes it seem like the answer is, no; or, not easily.
https://stackoverflow.com/questions/60177551/calling-rest-api-from-a-markdown-template https://stackoverflow.com/questions/60177551/calling-rest-ap...
Want examples of blogs where you'd want to make API calls from your page and not being able to in Markdown would be ruinous? Here's two from my blog.
A pretty much straight-from-Twitter page, nothing but Twitter API calls.
http://www.mediazed.com/bristol-colston-statue.html http://www.mediazed.com/bristol-colston-statue.html
Now you could say, that's a pretty artificial blog post structure, most bloggers wouldn't do that. So here's a more harmonious blend - a pretty regular blog post text blended with Twitter API calls.
http://www.mediazed.com/thiel-fellows.html http://www.mediazed.com/thiel-fellows.html
And lately I've been thinking of mixing in other embeded platform code (Insta, YouTube) - easily done like this, potentially a hassle with Markdown.
Now, maybe you can fight with Markdown and find some way to sprinkle in the embedded code, but if you ask me, it seems like: if I'm dealing with a lot of raw HTML at that point, why not just go all the way and, as a dev, do it all in HTML?
I don't see much value add in Markdown, at that point. And this is a perfectly valid, 'real-world' blog use case.
- dchest 6y agoMaybe you're thinking about sanitized Markdown, but proper Markdown allows HTML: For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags. https://daringfireball.net/projects/markdown/syntax https://daringfireball.net/projects/markdown/syntax * * * Unrelated to Markdown: CMS like WordPress have quick tags for embeds, e.g. your post with tweets could have been something like [tweet id="123..."] [tweet id="456..."] instead of the massive amount of code that you have to copy and paste, which will break if Twitter stops supporting that API, while this embed style would be easy to update.
- julianeon 6y agoInteresting! Thanks for adding that; I have to admit that makes the proposition much better.