xoofx / markdig

A fast, powerful, CommonMark compliant, extensible Markdown processor for .NET
BSD 2-Clause "Simplified" License
4.42k stars 457 forks source link

SketchFab Media links #486

Open LukeTOBrien opened 4 years ago

LukeTOBrien commented 4 years ago

Hello there

Do you think you could add SketchFab to your Media Extensions?
So you could have:

![Title goes here](https://skfb.ly/6stSI)

The embed code for SketchFab is much longer then YouTube though, for the above model the embed HTML is:

<div class="sketchfab-embed-wrapper">
    <iframe title="Title goes here" width="640" height="480" src="https://sketchfab.com/models/1e03509704a3490e99a173e53b93e282/embed?autostart=0&amp;ui_controls=1&amp;ui_infos=1&amp;ui_inspector=1&amp;ui_stop=1&amp;ui_watermark=1&amp;ui_watermark_link=1" frameborder="0" allow="autoplay; fullscreen; vr" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
    <p style="font-size: 13px; font-weight: normal; margin: 5px; color: #4A4A4A;">
        <a href="https://sketchfab.com/3d-models/the-rosetta-stone-1e03509704a3490e99a173e53b93e282?utm_medium=embed&utm_source=website&utm_campaign=share-popup" target="_blank" style="font-weight: bold; color: #1CAAD9;">The Rosetta Stone</a>
        by <a href="https://sketchfab.com/britishmuseum?utm_medium=embed&utm_source=website&utm_campaign=share-popup" target="_blank" style="font-weight: bold; color: #1CAAD9;">The British Museum</a>
        on <a href="https://sketchfab.com?utm_medium=embed&utm_source=website&utm_campaign=share-popup" target="_blank" style="font-weight: bold; color: #1CAAD9;">Sketchfab</a>
    </p>
</div>

So you might have to trim this down.

SketchFab also has a REST API, so it could be possible to HTTP.Get and await the user name, description and other information of the model.

What do you think?

xoofx commented 4 years ago

It is a bit more involving than the media extensions that we have today as we don't perform any HTTP queries when parsing the Markdown document while your code above seems to require this. It's a bit specific also, so for now, I think you can roll your own as Media extensions has some kind of extension mechanism via IHostProvider and see how it goes. SketchFab might be too specific audience to include it for now...

LukeTOBrien commented 4 years ago

Okay doke, I will take a look at IHostProvider, thanks!