Snapblocks

:information_source: Summary Allow users to use snapblocks in their posts.
:hammer_and_wrench: Repository Link GitHub - snap-blocks/snapblocks-discourse: snapblocks discourse plugin
:open_book: Install Guide How to install plugins in Discourse

Features

Snapblocks is a fork of scratchblocks that allows users to convert text into images of Snap! scripts. This Discourse plugin allows users to use snapblocks in their posts.

You can create snapblocks in a post, by typing snapblocks code inside [snapblocks][/snapblocks] bbcode tags. For example:

[snapblocks]
move (10) steps
[/snapblocks]

image

You can alternatively use [scratchblocks][/scratchblocks] for compatibility purposes (snapblocks is a fork of scratchblocks, and there was an old Discourse plugin on the Snap! forum that allowed users to type scratchblocks inside [scratchblocks][/scratchblocks] tags). I wanted this is be an option, but I don’t know how to access site settings from within the file that adds the bbcode tags

You can also use [sb][/sb] to add snapblocks code inline.

Use the [sb]move (10) steps[/sb] block to move forward.

image

Options

There are a few settings available to change how snapblocks are rendered.

  • Block Style
  • Block Scale
  • Zebra Coloring
  • Block Wrap
  • Show Spaces

Many options can also be used in snapblocks snippets.

[snapblocks blockStyle="snap-flat" wrap="true" wrapSize=100 zebra="true" showSpaces="false"]
if <[] = []> {
  forever {
    run ({} @addInput) with inputs [Hello world] @delInput @verticalEllipsis @addInput
  }
}
[/snapblocks]

image

You can also set the block style using the default parameter.

[snapblocks="snap-flat"]
move (10) steps
[/snapblocks]

image

Configuration

Name Description
Block Style The default block style. Can be snap, snap-flat, scratch2, scratch3, or scratch3-hc.
Block Scale The default block image scale. Must be a float.
Zebra Coloring If multiple blocks are the same color, alternate a lighter color.
Block Wrap Wrap block parts onto a new line if the block gets too wide.
Show Spaces Show spaces as a dot in inputs.

CHANGELOG

  • 1.1.1
    • Make sure overflowing scripts can be scrollable.
    • Added actual text when using the snapblocks button in the toolbar.
  • 1.1.0
    • Updated snapblocks to 1.6.0
  • 1.0.0
    • Initial release
10 Likes