Coder Social home page Coder Social logo

python-rst2ansi's Introduction

rst2ansi

build downloads pyversions format

A python module dedicated to rendering RST (reStructuredText) documents to ansi-escaped strings suitable for display in a terminal.

asciicast

Installation

Requirements

Python 3.3+

PyPi package

pip install rst2ansi

Usage

As a CLI utility:

usage: rst2ansi [-h] [file]

Prints a reStructuredText input in an ansi-decorated format suitable for
console output.

positional arguments:
  file        A path to the file to open

optional arguments:
  -h, --help  show this help message and exit

As a python module:

from rst2ansi import rst2ansi

print(rst2ansi('I **love** reStructuredText!'))

python-rst2ansi's People

Contributors

jwilk avatar snaipe avatar timcera avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

python-rst2ansi's Issues

Support Python 2.7.x

I came across this from HN, and it looked decent enough to want to give it a go, but alas

$ sudo pip install -U rst2ansi
Collecting rst2ansi
  Downloading rst2ansi-0.1.3.tar.gz
    Complete output from command python setup.py egg_info:
    This module is not supported on versions lower than python 3.3, sorry !
    Your version of python is 2.7.11, try installing it with a more recent version.
    ----------------------------------------

oh well, looks like my last visit here then

Request for new version posted to pypi

It would be helpful to one of my other projects to have the option list implementation that is in git to be available in a version from PyPI.

Kindest regards,
Tim

rst2ansi not rendering option lists correctly.

The attached file has option lists that rst2ansi does not correctly render. They are rendered using other utilities, specifically "rst2man" that comes with docutils.

test.txt

instead of the following from "rst2man":

              --type <str>
                     The plot type.  Defaults to 'time'.  Can be one of the following:

                     'time' standard time series plot,

                     'xy'   (x,y) plot, also know as a scatter plot,

                     'double_mass'
                            (x,y) plot of the cumulative sum of x and y,

"rst2ansi" gives:

--type<str>The plot type. Defaults to 'time'. Can be one of the following:

'time'standard time series plot,

'xy'(x,y) plot, also know as a scatter plot,

'double_mass'(x,y) plot of the cumulative sum of x and y,

Both correctly render the tables in the file.

This is using Python 3.4.

'str' object has no attribute 'decode'

With Python 3.6, trying readme's example, I get:

python-rst2ansi/rst2ansi/__init__.py", line 48, in rst2ansi
    out = core.publish_string(input_string.decode('utf-8'), settings_overrides=overrides, writer=Writer(unicode=output_encoding.startswith('utf')))
AttributeError: 'str' object has no attribute 'decode'

How to run this after installing it as a CLI command?

Sorry for a noob question, but I installed this utility like this:

pip3.7 install rst2ansi

And now I am not quite sure how to make it easy to run it from the terminal. Is there a wrapper in the package that I can invoke with a one liner command?

Executable script calls for python2

The main executable bin/rst2ansi starts with #!/usr/bin/python which aliases python2 (PEP 394). Should be #!/usr/bin/python3 or even better #!/usr/bin/env python3

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.