From cce479fccb03c8979dadc0315a6c8e446684bf65 Mon Sep 17 00:00:00 2001 From: Varun Ramesh Date: Wed, 6 Sep 2023 04:06:51 -0700 Subject: [PATCH] Updated to 0.6.0 --- README.md | 29 ++++++++++++++++++++-------- package.json | 2 +- src/{test.html => browser-unit.html} | 0 src/index.html | 6 +++++- webpack.config.js | 2 +- 5 files changed, 28 insertions(+), 11 deletions(-) rename src/{test.html => browser-unit.html} (100%) diff --git a/README.md b/README.md index be2105e..b992dba 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,9 @@ Add interactive code cells to any webpage, similar to [Jupyter](https://jupyter.org/) or [ObservableHQ](https://observablehq.com/). Works with direct HTML editing, static site generators like Jekyll / Hugo, and more. -## Quickstart +## Usage + +### Quickstart Just drop in JS / CSS imports and start creating code cells using ` - - + + ``` Try it on [CodePen](https://codepen.io/varunramesh/pen/WNYVNQQ) or [JSFiddle](https://jsfiddle.net/varunramesh/o217xpc5/9/). -## Using `pre` tags instead of `script` tags +### Other Languages -Script tags are great for defining notebook cells since they can hold pretty much any code without escaping. However, they are invisible by default, meaning that readers won't see anything until blog-cells loads. You can get around this by using `
` tags instead, however reserved HTML characters should be escaped using [HTML entities](https://developer.mozilla.org/en-US/docs/Glossary/Entity).
+In addition to JavaScript, you can also embed code in other languages by adding a `data-kernel` attribute.
 
 ```html
-
-console.log("<b>HELLO</b>");
-
+ ``` +The following kernel values are currently supported: +- `javascript` (Default) +- `python` + +### Cell Attributes + +Cells can be configured with the following attributes: + +- `data-autorun="true"` - Automatically run a cell on page load. Autorun cells are run in the order that they appear on the page. +- `data-hidden="true"` - Make a cell hidden by default - readers can toggle the cell's visibility. + ## Developing ``` diff --git a/package.json b/package.json index 5787ddc..07c258d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blog-cells", - "version": "0.5.0", + "version": "0.6.0", "description": "A tool for turning blog posts into interactive code notebooks.", "repository": { "type": "git", diff --git a/src/test.html b/src/browser-unit.html similarity index 100% rename from src/test.html rename to src/browser-unit.html diff --git a/src/index.html b/src/index.html index e970931..10bf75d 100644 --- a/src/index.html +++ b/src/index.html @@ -95,7 +95,11 @@

blog-cells demo

You can use other languages like Python.

- diff --git a/webpack.config.js b/webpack.config.js index d7268f8..cf90c52 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -55,7 +55,7 @@ const development = { plugins: [ new CopyPlugin({ patterns: [ - { from: "src/test.html", to: "." }, + { from: "src/browser-unit.html", to: "." }, ] }), ]