Microsoft MakeCode

Devs: MakeCode Blocks in Non-Markdown Docs

Hi, friends!

Question for you that’s come up in a project I’m working on:

Is there a “clean” way to generate code snippets in blocks without standing up your own, local server?

I know there’s this, which I love:

Snippets (makecode.com)

There’s also this, which is a huge head start for a lot of documents:

Blocks Gallery (makecode.com)

But is there something like the snippets renderer but available in a public playground?

I believe https://makecode.com/gh-pages-embed.js / the snippet that pops up at the bottom of the readme by default in gh projects

<script src="https://makecode.com/gh-pages-embed.js"></script><script>makeCodeRender("{{ site.makecode.home_url }}", "{{ site.github.owner_name }}/{{ site.github.repository_name }}");</script>

effectively does this; e.g. https://jwunderl.github.io/pxt-status-bar/README is what’s generated from https://github.com/jwunderl/pxt-status-bar (it’ll take a sec to load and then pop in the snippet) – you should be able to pull it out from the makeCodeRender there)

1 Like