Git Product home page Git Product logo
Docutils JS - Port of python docutils photo

docutils-js Goto Github PK

repos: 6.0 gists: 0.0

Name: Docutils JS - Port of python docutils

Type: Organization

Bio: This project is an effort to being thee excellent docutils and friends to thej Javascript ecosystem and provide plugins for common documentation projects

Docutils-JS

Author

Kay McCormick

Contact

[email protected]

Date

Thu 18 Apr 2019 06:40:03 PM PDT

Copyright

MIT License

Introduction

About the Docutils

The Docutils is a Python library for producing documentation based on a text format called RST or reStructuredText. RST is used for documenting many prominent software projects. While primarily in the Python ecosystem, the linux kernel also uses RST for its documentation.

About this software

Welcome to the port of the Docutils to JavaScript. This package is designed to enable reStructuredText (RST) processing (reading, transforming, writing) in a JavaScript environment. It is intended to work in a browser and in NodeJS.

Setup and configuration

  1. Clone the repository with git:
$ git clone http://github.com/kaymccormick/docutils-js.git docutils-js
  1. Enter the source directory:
$ cd docutils-js
  1. Install the dependencies using yarn:
$ yarn install
  1. Run grunt to transpile the source code:
$ yarn grunt
  1. The output of this command should be in the lib subdirectory. Then, optionally run the tests:
$ yarn jest

Using the API

Take a look at tools/rst2pojo.js. The API is in flux, because a straight port of the docutils interfaces is not appropriate for a JS API. JS does not have native IO - this is provided via the host in some way. Node provides its own fs module, and web browsers of course have many other ways of getting RST input, from XMLHttpRequest/fetch to extracting text from the current document or a form input (e.g. textarea).

Further, moving the IO responsibilities up the stack ensures that deferred/asynchronous execution is handled outside of the docutils-js module itself, improving the developer experience.

Example: For now, the simplest method to use the software appears to be:

const parse = require('../lib/index').parse;
const PojoWriter = require('../lib/writers/pojo.js').default;
const docSource = 'However you get your document sources'
const document = parse(docSource);

The variable document is now ready for further processing.

Addendum

Remaining to be implemented:

  • Transformers (output is not currently processed as docutils would)
  • Directives (there are a couple of no-op directives in place, such as image and contents.

There are currently quite a number of bugs.

  • Problems with sections
  • Problems with tables
  • Lack of transformers and directives
  • Running rst2xml.js on sample documents produces documents that 'work', sort-of, but which are significantly different from docutils-python output.

However, the project should be usable for people who want to experiment, play around, or contribute through bug fixes or feature enhancements.

Docutils JS - Port of python docutils's Projects

docserve icon docserve

Components for integration docutils and express

docutils-js icon docutils-js

Bringing reStructuredText and docutils to the JS Ecosystem

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.