Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
27 lines (16 loc) · 1.25 KB

File metadata and controls

27 lines (16 loc) · 1.25 KB
Copy raw file
Download raw file
Outline
Edit and raw actions

Blocks embedding

MakeCode provides a lightweight blocks rendering engine that renders code snippets as SVG images.

The Curse of screenshots

Unlike text based programming languages, block-based snippets aren't easily rendered in a documentation page. A quick solution is take screenshots of the snippets but things can quickly become unsustainable:

  • screenshots can't be compiled - so it's hard to maintain them
  • screenshots are not localizable - non-English speaking users won't be able to read the blocks
  • screenshots aren't easily reloaded into the editor
  • screenshots don't play well with source control systems - you cannot diff changes efficiently

Rendering blocks on the spot

The MakeCode approach in solving this problem is to render the JavaScript code snippets on a client using the same block rendering engine as the editor. Under the hood, an IFrame from the MakeCode editor will render the blocks for you.

Plugins

Here are some sample integrations for various documentation/blogging engines.

Manual Implementation

You can find example of custom blocks embedding in the documentation of your favorite editor.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.