From 8bb3fce3382bfeb0f8befc9b474c4618fb5a6092 Mon Sep 17 00:00:00 2001 From: Martin Matusiak Date: Sun, 9 Mar 2014 12:56:29 +0100 Subject: simplify readme, move getting started into docs/ --- README.rst | 58 ++-------------------------------------------------------- 1 file changed, 2 insertions(+), 56 deletions(-) (limited to 'README.rst') diff --git a/README.rst b/README.rst index a3d16a7..86909e7 100644 --- a/README.rst +++ b/README.rst @@ -31,59 +31,7 @@ Installation Getting started --------------- -To highlight using colors: - -.. literalinclude:: snippets/getting_started_1.py - -.. figure:: snippets/getting_started_1.png - - -This will emit ansi escapes into the string: one when starting a color, another -to reset the color back to the default: - -.. code:: python - - >>> from ansicolor import green - - >>> green("green") - '\x1b[0;0;32mgreen\x1b[0;0m' - - -If I want to be able to pass a color as an argument I can also use the -``colorize`` function: - -.. code:: python - - from ansicolor import Colors - from ansicolor import colorize - - print(colorize("I'm blue", Colors.Blue)) - - -I can also apply color on a portion of a string: - -.. code:: python - - from ansicolor import Colors - from ansicolor import wrap_string - - print(wrap_string("I'm blue, said the policeman.", 8, Colors.Blue)) - - -Sometimes I may have a string that contains markup and I'll want to do something -with it that concerns only the text, so I can strip the markup: - -.. code:: python - - >>> from ansicolor import red - >>> from ansicolor import strip_escapes - >>> from ansicolor import yellow - - >>> message = "My favorite colors are %s and %s" % (yellow("yellow"), red("red")) - >>> print("The length of this string is not: %d" % len(message)) - The length of this string is not: 67 - >>> print("The length of this string is: %d" % len(strip_escapes(message))) - The length of this string is: 37 +Read the `documentation` on Read the Docs! Going further @@ -97,7 +45,5 @@ Take a look at the ``demos`` to see what's possible. $ python -m ansicolor.demos --highlight $ python -m ansicolor.demos --diff -Also see the `API documentation`_. - -.. _`API documentation`: https://ansicolor.readthedocs.org/ +.. _`documentation`: https://ansicolor.readthedocs.org/ -- cgit v1.2.1