DEV Community

Discussion on: Using DEV.to as a CMS

Collapse
 
rhymes profile image
rhymes

Hi shawn, neat tricks! A note about this:

Dev.to's API only exports the raw markdown

the API exports the processed HTML if you retrieve a single article by its id, for example:

> curl https://dev.to/api/articles/266934 | jq '.body_html'
"<p>This is a post on Dev.to that should also appear on my personal site. Canonical URL is manually set so that my site is the authoritative source, but the content lives in Dev.to.</p>\n\n<p>See the comparison:</p>\n\n<ul>\n<li>Dev.To URL: <a href=\"https://dev.to/swyx/using-dev-to-as-a-cms-3472/\">https://dev.to/swyx/using-dev-to-as-a-cms-3472/</a>\n</li>\n<li>Swyx.io URL: <a href=\"https://www.swyx.io/writing/devto-cms/\">https://www.swyx.io/writing/devto-cms/</a>\n</li>\n</ul>\n\n<p><a href=\"https://twitter.com/bendhalpern/status/1176663688742395904?s=20\">In Se
Collapse
 
swyx profile image
swyx

It looks like they use highlight.js for syntax highlighting, whereas I use github.com/octref/shiki/, and also use github.com/remarkjs/remark-toc for table of contents so i probably need to continue processing the raw markdown but thank you!

Collapse
 
swyx profile image
swyx

ah TIL! thank you!