liminoid-mdx v0.0.17
Interactive local-first Python documents.... that are as easy as putting code fences in your Markdown!
Installation
$ yarn add liminoid-mdx
or
$ npm install --save liminoid-mdx
Usage
For a more comprehensive guide to using the package see the documentation or browse the examples. Any code fences with py
or python
and at least one of the meta tags will be rendered as an interactive Python editor that executes code in the browser.
```python packages=['numpy']; edit=true
import numpy as np
np.random.rand(3,2)
```
multiple meta tags must be seperated with a
;
Liminoid CLI
$ liminoid serve my-doc.mdx
Webpack
$ npm init mdx webpack
$ cd webpack-mdx
$ yarn add liminoid-mdx
// webpack.config.js
const liminoid = require('liminoid-mdx');
module.exports = {
mode: 'development',
module: {
rules: [
{
test: /\.js$/,
use: 'babel-loader',
},
{
test: /\.mdx?$/,
use: [
'babel-loader',
{
loader: '@mdx-js/loader',
options: {
remarkPlugins: [liminoid],
},
},
],
},
],
},
};
$ yarn start #=> ... Project is running at http://localhost:8080/
Gatsby
$ npm init mdx gatsby
$ cd gatsby-mdx
$ yarn add liminoid-mdx
// gatsby.config.js
const liminoid = require('liminoid-mdx');
module.exports = {
plugins: [
{
resolve: 'gatsby-plugin-mdx',
options: {
// ...
remarkPlugins: [liminoid],
},
},
],
};
$ yarn start #=> ... Project is running at http://localhost:8000/
meta
name | default | values | description |
---|---|---|---|
packages | [] | Array : package names currently avalable in Pyodide | Uses Pyodide's loadPackage() to preload packages |
console | true | Boolean : true or false | false disables the HTML console which displays the results. |
edit | true | Boolean : true or false | false disables the textarea input while still allowing the embedded code to be run. |
scope | false | Boolean : true or false | true creates a new Repl() for the component with its own Python context. false shares the Repl() context between editors globally, i.e. one editor can reference variables from another. |
onResult | undefined | Function : function expression or reference | callback function that receives the results when the code is run. (res, err) => { ... } |
Contributing/Requests
Open an issue or post a message in the chatroom. If you would like to contribute to the project (code, documentation, tutorials, etc.) see the contributing guide for how to get started 🙌
Citing
While not required, when using (or extending) Liminoid for academic work, citations are appreciated 🙏
@software{liminoid,
author = {Jonathan Dinu},
title = {Liminoid: Web assembly toolkit for building local-first interactive analytics applications},
month = {March},
year = {2020},
version = {0.0.1},
doi = {10.5281/zenodo.3754953},
url = {https://github.com/liminoid},
}
License
All original work licensed under either of:
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.