Sketchfab Macro
Asked by oXL0C0Xo:

Hello, I'm trying to add a macro to my editor so that this html code will get executed with the user only supplying the last field of a URL. Here's the code:

```
&lt;iframe width="640" height="480" src="https://sketchfab.com/models/3e687de1cfe141b7b0f6fc664944a8de/embed" frameborder="0" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel=""&gt;&lt;/iframe&gt;&lt;p style="font-size: 13px; font-weight: normal; margin: 5px; color: #4A4A4A;"&gt;    &lt;a href="https://sketchfab.com/models/3e687de1cfe141b7b0f6fc664944a8de" style="font-weight: bold; color: #1CAAD9;"&gt;Scene_000&lt;/a&gt;    by &lt;a href="https://sketchfab.com/fpg" style="font-weight: bold; color: #1CAAD9;"&gt;Foul Play Games&lt;/a&gt;    on &lt;a href="https://sketchfab.com" style="font-weight: bold; color: #1CAAD9;"&gt;Sketchfab&lt;/a&gt;&lt;/p&gt;
```

What I need to be able to replace is both instances of 3e687de1cfe141b7b0f6fc664944a8de So that the user can just add that to display a model that they have uploaded to the sketchfab site.

Thank you for your time,

Bryon


Answers:
author: Robert Massaioli _Atlassian_
body: If you have a Cloud site I wrote an add-on that can do this yesterday called: [Sketchfab for Confluence](https://marketplace.atlassian.com/plugins/com.atlassian.confluence.sketchfab-connect).

It's completely free so you should install it and give it a try.

comments: author: Peter Clarke
body: Hi Robert,

I love this add-on, but I can't get it to render the iframe full width.

Is there a width setting somewhere I'm missing?


author: Robert Massaioli _Atlassian_
body: There is no width setting. I just imagined that the default size that came back would be acceptable. Do the Confluence formatting features not work for you with respect to positioning the box? Or would you just like more of it to show?

At any rate, I raised an issue for this: <https://bitbucket.org/robertmassaioli/sketchfab-connect/issues/4/make-it-possible-to-declare-the-width-of>


author: Peter Clarke
body: Thanks Robert.

I replied in the issue... but basically, I'd like to see the whole box.


author: HosseinA
body: Hi Bryon,

I think you can write a User Macro for this. Please refer to [](https://confluence.atlassian.com/display/DOC/Writing+User+Macros)<https://confluence.atlassian.com/display/DOC/Writing+User+Macros>

You can make the macro visible for all users, and select "Unrendered" for body processing.

In template, you can have:

```
&lt;iframe width="640" height="480" src="https://sketchfab.com/models/$body/embed" frameborder="0" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel=""&gt;&lt;/iframe&gt; &lt;p style="font-size: 13px; font-weight: normal; margin: 5px; color: #4A4A4A;"&gt;    &lt;a href="https://sketchfab.com/models/3e687de1cfe141b7b0f6fc664944a8de" style="font-weight: bold; color: #1CAAD9;"&gt;Scene_000&lt;/a&gt;    by &lt;a href="https://sketchfab.com/fpg" style="font-weight: bold; color: #1CAAD9;"&gt;Foul Play Games&lt;/a&gt;    on &lt;a href="https://sketchfab.com" style="font-weight: bold; color: #1CAAD9;"&gt;Sketchfab&lt;/a&gt;&lt;/p&gt;
```

Note "$body" in above code, as that takes the body of the macro. After saving that. You can insert the marco in your pages and in the body of macro, you can have the ID of the model you wish to display.

I hope this helps :)


Tags: confluence-administration

user-macro