Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tylfin/restructedpyjs
Javascript Library to convert reStructuredText to HTML using Pyodide
https://github.com/tylfin/restructedpyjs
Last synced: 3 days ago
JSON representation
Javascript Library to convert reStructuredText to HTML using Pyodide
- Host: GitHub
- URL: https://github.com/tylfin/restructedpyjs
- Owner: tylfin
- License: mit
- Created: 2023-05-09T18:11:31.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-28T20:50:02.000Z (16 days ago)
- Last Synced: 2024-10-28T21:35:08.494Z (16 days ago)
- Language: JavaScript
- Homepage:
- Size: 1.32 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RestructedPyJS
[![Build and Test](https://github.com/tylfin/restructedpyjs/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/tylfin/restructedpyjs/actions/workflows/build-and-test.yml) [![Inline demo](https://img.shields.io/badge/Try_it_out-demo-informational)](https://forcepushrevert.com/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.
## Installation
To use RestructedPyJS, first install it using npm:
```bash
npm install restructedpyjs
```## Usage
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.
## Pyodide
This library uses [Pyodide](https://github.com/pyodide/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 (v23 or later)
### Installation Dev
To install the development dependencies, run:
```bash
npm install
```### Building
To build the library, run:
```bash
npm run build
```### Testing
To run the tests, run:
```bash
npm test
```### License
RestructedPyJS is licensed under the MIT License. See the LICENSE file for more information.