A JavaScript library that loads PyScript to convert Restructured Text to HTML
npm install restructedpyjs 
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.
To use RestructedPyJS, first install it using npm:
``bash`
npm install restructedpyjs
Add the source snippet:
`html`
Then the following JS should work:
`js
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.
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.
- Node.js (v23 or later)
To install the development dependencies, run:
`bash`
npm install
To build the library, run:
`bash`
npm run build
To run the tests, run:
`bash``
npm test
RestructedPyJS is licensed under the MIT License. See the LICENSE file for more information.