Embed Mastodon post/toot

Use case or problem

Twitter is failing and is a very sad place, even sadder than it was a year or two ago. A lot of the most interesting discussions are happening on Mastodon now, and other places in the Fediverse.

Obsidian already has a very useful embed function for YouTube video and Tweets. Can there be an embed for a Mastadon post?

This would be a start for support for the Fediverse, and as the ActivityPub protocol develops and is adopted by more organizations and platforms, embedded an ActivityPub action would be even more useful.

Proposed solution

Similar to embedding a Tweet.

Current workaround (optional)

Currently I use a normal link to a [post](https://mas.to/@obsidian/111495540391606053).

But Mastodon already offers an iframe embed code for all posts. It would be nice to have this done automatically, as a first class embed.

<iframe src="https://mas.to/@obsidian/111495540391606053/embed" width="400" allowfullscreen="allowfullscreen" sandbox="allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-forms"></iframe>

Related feature requests (optional)


Pitching in my support for Mastodon toot embeds, just the way they work with Twitter. :+1:

Yup, there’s that Mastodon embed code that does work, but that requires a bit more manual work, and you need to delete part of the embed code Mastodon feeds to you (or so it seems; my Mastodon server inserts it automatically); the following part seems excessive:

<script src="https://assets.infosec.exchange/embed.js" async="async"></script>

Looks like you only need the first part of the embed code for Obsidian embeds:

<iframe src="https://infosec.exchange/@aleave/111730570909794213/embed" class="mastodon-embed" style="max-width: 100%; border: 0" width="800" allowfullscreen="allowfullscreen"></iframe>

By the way, @majdal, do you know of a way to control the height of an embedded toot? I can swap the default width parameter from the default 400 to 800, which is the width I prefer, but it appears impossible to make the toots appear in full height here? :thinking: Or at least to be taller than they currently are? I tried inserting the height parameter in the embed code and experimenting with it, but toot embeds still remain in default height for me in Obsidian, which I find insufficient for a nice display of embedded toots. This height control may be/likely is a Mastodon rather than an Obsidian thing, of course.