0.0.17 • Published 4 years ago

liminoid-mdx v0.0.17

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

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

namedefaultvaluesdescription
packages[]Array: package names currently avalable in PyodideUses Pyodide's loadPackage() to preload packages
consoletrueBoolean: true or falsefalse disables the HTML console which displays the results.
edittrueBoolean: true or falsefalse disables the textarea input while still allowing the embedded code to be run.
scopefalseBoolean: true or falsetrue 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.
onResultundefinedFunction: function expression or referencecallback 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.

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.13

4 years ago

0.0.14

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago