local function ensureHtmlDeps() quarto.doc.addHtmlDependency({ name = 'mastodon-comments', version = '1.0.0', scripts = {"mastodon-comments.js"}, }) end function Meta(m) ensureHtmlDeps() if m.mastodon_comments and m.mastodon_comments.user and m.mastodon_comments.toot_id and m.mastodon_comments.host then local user = pandoc.utils.stringify(m.mastodon_comments.user) local toot_id = pandoc.utils.stringify(m.mastodon_comments.toot_id) local host = pandoc.utils.stringify(m.mastodon_comments.host) local mastodon_html = '' -- JavaScript to inject Mastodon comments into a specific div local inject_script = [[ ]] -- Include external scripts and styles directly local script_html = '' local css_html = '' -- Insert these elements in the document's head quarto.doc.includeText("in-header", script_html .. css_html .. inject_script) -- JavaScript variable definitions local js_vars = '' -- Include JavaScript variables in the header quarto.doc.includeText("in-header", js_vars) end end