0.0.19 • Published 7 months ago

restructedpyjs v0.0.19

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

RestructedPyJS

Build and Test Inline demo

A JavaScript library that loads Pyodide to convert Restructured Text (RST) to HTML.

Warning: This library is still an experiment and may not be safe for use without input sanitization.

Installation

To use RestructedPyJS, first install it using npm:

npm install restructedpyjs

Usage

Add the source snippet:

<script src="https://cdn.jsdelivr.net/pyodide/v0.24.1/full/pyodide.asm.js"></script>
<script src="https://unpkg.com/restructedpyjs@latest/dist/restructedpyjs.bundle.js"></script>

Then the following JS should work:

const RestructedPyJS = require('restructedpyjs').default;

const rstToHtml = async (rstText) => {
  const restructedpyjs = new RestructedPyJS();
  const html = await restructedpyjs.convert(rstText);
  return html;
}

const inputText = 'Hello, Python!';
rstToHtml(inputText).then(html => console.log(html));

The convert() method of RestructedPyJS converts the provided Restructured Text (RST) input to HTML output.

Pyodide

This library uses Pyodide to load Python in the browser. Pyodide provides a full Python environment, including packages and modules, that can run entirely in the browser. This library will automatically download Pyodide and other required packages for you.

Development

Requirements

  • Node.js (v14 or later)

Installation Dev

To install the development dependencies, run:

npm install

Building

To build the library, run:

npm run build

Testing

To run the tests, run:

npm test

License

RestructedPyJS is licensed under the MIT License. See the LICENSE file for more information.

0.0.10

8 months ago

0.0.11

8 months ago

0.0.12

8 months ago

0.0.13

8 months ago

0.0.14

8 months ago

0.0.15

8 months ago

0.0.9

8 months ago

0.0.16

8 months ago

0.0.17

8 months ago

0.0.18

7 months ago

0.0.19

7 months ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago