New feature: online snippets

I’ve added a snippet feature to the Borogove online IF editor. It lets people share small parser IF projects with links or with the code and an interpreter embedded to a web page.

Here on the forums it can be used for example when asking about a coding problem to demonstrate the issue, or when answering to include a demo of how the solution works. You can also publish code that doesn’t compile. If you include a snippet with a question, it’s easy for anyone to quickly check what it does, edit it and post the edited version.

Here’s an example of an embedded Inform 6 project (more examples at the bottom of the post):

The available languages are Inform 6 and 7, Hugo, Dialog and Vorple for I6/I7. The standard libraries are included by default and Inform 7 projects can use any extensions in the Public Library.

There’s a limit of 12,000 characters and you can’t edit or delete a snippet after publishing it. If you need to make changes you can edit the code and then publish it again as a new snippet.

Here’s how to use it:

  • Go to snippets.borogove.app
  • Choose a system
  • Write the code
  • Click on “share” in the top menu
  • Copy-paste the HTML code that it shows to embed the snippet in a post. Clicking on “Direct address” gives a normal link without embedding.

In the embedded view the Play button compiles and runs the code in an interpreter, Edit opens a full editor in a new tab, and Copy copies the code to the clipboard.

This is in preparation for a full publishing feature later that would let you publish complete games with a full set of publishing options.

More examples (click to show)

Inform 7

Hugo

Dialog

Vorple

12 Likes

Very nice! It now works on my RPi 4 / Google Chrome.

Thank you!

don’t work here under “armoured firefox” (firefox+adblocker+noscript), with noscript allowing temporary access to snippets.borogrove.app
I got an error message “Could not fetch snippet contents” in red at the center of the embedded window.

Best regards from Italy,
dott. Piergiorgio.

If you can, allow access to *.borogove.app. The snippet contents are coming from snippets-api.borogove.app so allowing that should help with at least seeing the content.

This is a great idea. On the iOS Discourse Hub app and also on Safari I get the following message when I press play:

Cannot initialize storage system.

Your browser’s security settings may block features when running the app embedded in another web page. You can try opening the app in a separate window instead.

It’s followed by a prompt to “open in a new tab/window” which works fine.

I wonder whether you could write a plugin for Discourse to let the text be typed or copied directly into a post and be played here.

With the current system it’s not possible to go around the security measures that some browsers have, but it could possibly be made to open the interpreter in a new window automatically if it detects that it can’t be run embedded.

Yes, that would be good. It should work on the iOS Discourse Hub app too, as it seems just to be a glorified web browser.

It works perfectly on the iPhone now (on the Discourse Hub app, Safari, Chrome, Firefox and Edge!)

Just discovering and trying this…

1 Like