~kaijanmaki/+junk/indicators-ng

« back to all changes in this revision

Viewing changes to zinc/python/zinc/util/Markdown-2.6.2/docs/extensions/smarty.txt

  • Committer: Antti Kaijanmäki
  • Date: 2015-09-21 20:43:11 UTC
  • Revision ID: antti.kaijanmaki@canonical.com-20150921204311-bnmu8s14n6ovobyu
foo

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
title: SmartyPants Extension
 
2
prev_title: Sane Lists Extension
 
3
prev_url:   sane_lists.html
 
4
next_title: Table of Contents Extension
 
5
next_url:   toc.html
 
6
 
 
7
SmartyPants
 
8
===========
 
9
 
 
10
Summary
 
11
-------
 
12
 
 
13
The SmartyPants extension converts ASCII dashes, quotes and ellipses to
 
14
their HTML entity equivalents.
 
15
 
 
16
ASCII symbol | Replacements    | HTML Entities       | Substitution Keys
 
17
------------ | --------------- | ------------------- | ----------------------------------------
 
18
`'`          | ‘ ’ | `‘` `’` | `'left-single-quote'`, `'right-single-quote'`
 
19
`"`          | “ ” | `“` `”` | `'left-double-quote'`, `'right-double-quote'`
 
20
`<< >>`      | &laquo; &raquo; | `&laquo;` `&raquo;` | `'left-angle-quote'`, `'right-angle-quote'`
 
21
`...`        | &hellip;        | `&hellip;`          | `'ellipsis'`
 
22
`--`         | &ndash;         | `&ndash;`           | `'ndash'`
 
23
`---`        | &mdash;         | `&mdash;`           | `'mdash'`
 
24
 
 
25
Using the configuration option 'substitutions' you can overwrite the
 
26
default substitutions. Just pass a dict mapping (a subset of) the 
 
27
keys to the substitution strings.
 
28
    
 
29
For example, one might use the following configuration to get correct quotes for 
 
30
the German language:
 
31
 
 
32
    extension_configs = {
 
33
        'markdown.extensions.smarty': {
 
34
            'substitutions': {
 
35
                'left-single-quote': '&sbquo;', # sb is not a typo!
 
36
                'right-single-quote': '&lsquo;',
 
37
                'left-double-quote': '&bdquo;',
 
38
                'right-double-quote': '&ldquo;'
 
39
            }
 
40
        }
 
41
    }
 
42
 
 
43
!!! note
 
44
    This extension re-implements the Python [SmartyPants] 
 
45
    library by integrating it into the markdown parser.
 
46
    While this does not provide any additional features,
 
47
    it does offer a few advantages. Notably, it will not 
 
48
    try to work on highlighted code blocks (using the 
 
49
    [CodeHilite] Extension) like the third party library 
 
50
    has been known to do.
 
51
    
 
52
[SmartyPants]: http://pythonhosted.org/smartypants/
 
53
[CodeHilite]: code_hilite.html
 
54
 
 
55
Usage
 
56
-----
 
57
 
 
58
See [Extensions](index.html) for general extension usage, specify 
 
59
`markdown.extensions.smarty` as the name of the extension.
 
60
 
 
61
See the [Library Reference](../reference.html#extensions) for information about
 
62
configuring extensions.
 
63
 
 
64
The following options are provided to configure the output:
 
65
 
 
66
Option                | Default value | Description
 
67
------                | ------------- | -----------
 
68
`smart_dashes`        | `True`        | whether to convert dashes
 
69
`smart_quotes`        | `True`        | whether to convert straight quotes
 
70
`smart_angled_quotes` | `False`       | whether to convert angled quotes
 
71
`smart_ellipses`      | `True`        | whether to convert ellipses
 
72
`substitutions`       | `{}`          | overwrite default substitutions
 
73
 
 
74
Further reading
 
75
---------------
 
76
 
 
77
SmartyPants extension is based on the original SmartyPants implementation
 
78
by John Gruber. Please read it's [documentation][1] for details.
 
79
 
 
80
[1]: http://daringfireball.net/projects/smartypants/