From 7c253d3fee18ff79c1fd446126bc577cb2658456 Mon Sep 17 00:00:00 2001 From: Reorx Date: Wed, 18 May 2022 13:46:15 +0800 Subject: new shortcode: social-quote-tweet; enhance h2, h3 margin --- layouts/shortcodes/social-quote-tweet.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 layouts/shortcodes/social-quote-tweet.html (limited to 'layouts/shortcodes') diff --git a/layouts/shortcodes/social-quote-tweet.html b/layouts/shortcodes/social-quote-tweet.html new file mode 100644 index 0000000..d8b21ca --- /dev/null +++ b/layouts/shortcodes/social-quote-tweet.html @@ -0,0 +1,16 @@ +
+
+ {{ safeHTML (index $.Site.Data.svg "twitter-simple") }} + {{ with .Inner }}{{ . }}{{ end }} +
+ {{ $user := .Get "user" }} + {{ $id := .Get "id" }} + {{ $dnt := true }} + {{- .Inner -}}{{/* not required, only to not break Obsidian highlight by adding `/` before `>` */}} + + {{- $url := printf "https://twitter.com/%v/status/%v" $user $id -}} + {{- $query := querify "url" $url "dnt" $dnt -}} + {{- $request := printf "https://publish.twitter.com/oembed?%s" $query -}} + {{- $json := getJSON $request -}} + {{- replaceRE "" "" $json.html | safeHTML -}} +
-- cgit v1.2.3