news-catalyst / tiny-news-demo

a demo of a tiny publishing system powered by gatsby + google docs
MIT License
1 stars 0 forks source link

Simplified embed functionality by matching a URL alone #76

Closed jacqui closed 4 years ago

jacqui commented 4 years ago

Related to issue #58, this PR simplifies the code in the article template that handles looking for social media embeds: now it matches a URL on its own line and replaces it with the appropriate embed code.

This was previously more complicated because of how Google Docs seems to handle URLs surrounded by plain text: they come through as a parent node with multiple children nodes, with the text broken up among them. Matching a URL on its own, regardless of whether it is hyperlinked in the doc or not, is a lot more straightforward.