summaryrefslogtreecommitdiff
path: root/docs/introduction.rst
blob: cfa8c060c6416001a791a2e0b922ea39ffb1d77b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
============
Introduction
============

smartypants_ is a Python fork of SmartyPants__.

.. _smartypants: https://bitbucket.org/livibetter/smartypants.py
__ SmartyPantsPerl_
.. _SmartyPantsPerl: http://daringfireball.net/projects/smartypants/

smartypants can perform the following transformations:

- Straight quotes (``"`` and ``'``) into “curly” quote HTML entities
- Backticks-style quotes (````like this''``) into “curly” quote HTML entities
- Dashes (``--`` and ``---``) into en- and em-dash entities
- Three consecutive dots (``...`` or ``. . .``) into an ellipsis entity

This means you can write, edit, and save your posts using plain old
ASCII straight quotes, plain dashes, and plain dots, but your published
posts (and final HTML output) will appear with smart quotes, em-dashes,
and proper ellipses.

smartypants does not modify contents in some HTML element, see :ref:`Skipped HTML
Elements <skip-html>`. Typically, these tags are used to display text where
smart quotes and other "smart punctuation" would not be appropriate, such as
source code or example markup.


Quick usage
===========

To use it as a module:

.. code:: python

  import smartypants

  text = '"SmartyPants" is smart, so is <code>smartypants</code> -- a Python port'
  print(smartypants.smartypants(text))

To use the command-line script ``smartypants``:

.. code:: sh

  echo '"SmartyPants" is smart, so is <code>smartypants</code> -- a Python port' | smartypants

Both produce::

  &#8220;SmartyPants&#8221; is smart, so is <code>smartypants</code> &#8212; a Python port


Installation
============

smartypants can be installed via ``pip``::

  $ pip install smartypants