# Discourse Blocks

**URL:** <https://meta.discourse.org/t/discourse-blocks/57193>\
**Category:** Plugin\
**Tags:** broken\
**Created:** [February 10, 2017, 8:02am UTC](https://meta.discourse.org/t/discourse-blocks/57193 "2017-02-10T08:02:55Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jgujgu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jgujgu/32/64012_2.png) [@jgujgu](https://meta.discourse.org/u/jgujgu)\
**Post date:** [February 10, 2017, 8:02am UTC](https://meta.discourse.org/t/discourse-blocks/57193/1 "2017-02-10T08:02:55Z")

</div>

If you’d like to display interactive data visualizations in your Discourse’s posts, do I have the plugin for you. :dosequis:

###Introducing…  
#[📈 discourse-blocks 📉] ([https://graphme.io/t/how-does-life-expectancy-correlate-with-a-countrys-gdp-per-capita/204/3](https://graphme.io/t/how-does-life-expectancy-correlate-with-a-countrys-gdp-per-capita/204/3)) 👈 Live demo

To install, add this, as normal, to `app.yml`:

```plaintext
- git clone https://github.com/jgujgu/discourse-blocks.git

```

❗ But also please add these under `env` by the other variables in `app.yml`. You can generate them if you have a Github account:

```
GITHUB_CLIENT_ID: "a_github_client_id"
GITHUB_SECRET_KEY: "a_longer_github_secret_key"

```

Visit Github for a full list of screenshots:  
[https://github.com/jgujgu/discourse-blocks](https://github.com/jgujgu/discourse-blocks)

I am currently running `1.8+`, but it worked just fine on `~1.6` as well.

What does this plugin really do? (since you didn’t click the live demo :yuno:)

If a poster inserts a link to a Github Gist with an `index.html` file, this plugin will render it and any code + files that run alongside it. Essentially, anything that [bl.ocks](https://bl.ocks.org/) made famous and [blockbuilder](http://blockbuilder.org/) makes convenient to create will render through this plugin. The bulk of examples are data visualizations, but a `block` need not be.

If you have a question or feedback, feel free to post it here or [here](https://graphme.io/c/site-feedback).

![](https://global.discourse-cdn.com/meta/original/3X/2/0/2017ff00da6844c05eec6359ef74a9f0879f0a49.gif)

Alongside this plugin, I would also like to invite you to join [graphme](https://graphme.io), **answers that show not tell**  
📈📈📈|📈📈📈|📄📈📈|📈📈📈|📈📄📄|📄📉📉|📉📉📉  
📈📄📈|📈📄📄|📈📄📈|📈📄📈|📈📄📄|📉📄📄|📉📄📄  
📈📈📈|📈📄📄|📄📈📈|📈📈📈|📈📈📈|📄📉📉|📉📉📉  
📄📄📈|📄📄📄|📄📄📄|📈📄📄|📈📄📈|📉📄📄|📉📄📄  
📈📈📈|📄📄📄|📄📄📄|📈📄📄|📈📄📈|📄📉📉|📉📉📉

This is ( **ahem** _will be_) a Q&A site that welcomes interactive graphs, diagrams, and infographics as answers. If you have a potentially graphical question needling you in the back, please do ask it there. I’m sure it is interesting if it’s doing that.

---

<div class="post-metadata">

**Author:** ![mitchellk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mitchellk/32/120419_2.png) [@mitchellk](https://meta.discourse.org/u/mitchellk)\
**Post date:** [February 10, 2017, 8:36am UTC](https://meta.discourse.org/t/discourse-blocks/57193/2 "2017-02-10T08:36:40Z")

</div>

That is awesome, well done and thank you for contributing a great plugin.

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [February 10, 2017, 2:43pm UTC](https://meta.discourse.org/t/discourse-blocks/57193/3 "2017-02-10T14:43:37Z")

</div>

Wondering why not simply implement a onebox here?

---

<div class="post-metadata">

**Author:** ![jgujgu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jgujgu/32/64012_2.png) [@jgujgu](https://meta.discourse.org/u/jgujgu)\
**Post date:** [February 10, 2017, 8:06pm UTC](https://meta.discourse.org/t/discourse-blocks/57193/4 "2017-02-10T20:06:11Z")

</div>

I’ll look into doing this at some point. With my current implementation, I was so focused on correctly packaging up the iframe (and nudging the user to do so) that I didn’t think about using Github’s oEmbed API.

---

<div class="post-metadata">

**Author:** ![ChrisBeach](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chrisbeach/32/214628_2.png) [@ChrisBeach](https://meta.discourse.org/u/ChrisBeach)\
**Post date:** [February 14, 2017, 1:21pm UTC](https://meta.discourse.org/t/discourse-blocks/57193/5 "2017-02-14T13:21:26Z")

</div>

I’ve just spotted this and it looks excellent.

Are there enough safeguards in place to allow regular members to use this feature? Allowing arbitrary code to run on my site is a pretty scary concept 😬

---

<div class="post-metadata">

**Author:** ![jgujgu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jgujgu/32/64012_2.png) [@jgujgu](https://meta.discourse.org/u/jgujgu)\
**Post date:** [February 14, 2017, 3:11pm UTC](https://meta.discourse.org/t/discourse-blocks/57193/6 "2017-02-14T15:11:35Z")

</div>

From what I know, the different options in iframe sandboxing can safely prevent a user from accessing information on your site.

Whitelisting both `allow-scripts` and `allow-same-origin` is probably the most dangerous thing to do, as it allows running javascript and access to the parent page. However, I have allowed only `allow-scripts` in my iframes.

> **[Play safely in sandboxed IFrames  |  Articles  |  web.dev](https://web.dev/articles/sandboxed-iframes)**

> <https://stackoverflow.com/questions/35208161/is-it-safe-to-have-sandbox-allow-scripts-allow-popups-allow-same-origin-on-if/35208356#35208356>

---

<div class="post-metadata">

**Author:** ![awesomerobot](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/awesomerobot/32/142900_2.png) [@awesomerobot](https://meta.discourse.org/u/awesomerobot)\
**Post date:** [July 23, 2026, 5:41pm UTC](https://meta.discourse.org/t/discourse-blocks/57193/7 "2026-07-23T17:41:59Z")

</div>


