aboutsummaryrefslogtreecommitdiffstats
path: root/docs/extensions/smarty.md
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2017-12-06 23:18:29 -0500
committerGitHub <noreply@github.com>2017-12-06 23:18:29 -0500
commitb62ddeda02fadcd09def9354eb2ef46a7562a106 (patch)
tree37149361ca1eeb8c24942835b2f933105fa920ed /docs/extensions/smarty.md
parentde5c696f94e8dde242c29d4be50b7bbf3c17fedb (diff)
downloadmarkdown-b62ddeda02fadcd09def9354eb2ef46a7562a106.tar.gz
markdown-b62ddeda02fadcd09def9354eb2ef46a7562a106.tar.bz2
markdown-b62ddeda02fadcd09def9354eb2ef46a7562a106.zip
Switch docs to MKDocs (#602)
Fixes #601. Merged in 6f87b32 from the md3 branch and did a lot of cleanup. Changes include: * Removed old docs build tool, templates, etc. * Added MkDocs config file, etc. * filename.txt => filename.md * pythonhost.org/Markdown => Python-Markdown.github.io * Markdown lint and other cleanup. * Automate pages deployment in makefile with `mkdocs gh-deploy` Assumes a git remote is set up named "pages". Do git remote add pages https://github.com/Python-Markdown/Python-Markdown.github.io.git ... before running `make deploy` the first time.
Diffstat (limited to 'docs/extensions/smarty.md')
-rw-r--r--docs/extensions/smarty.md78
1 files changed, 78 insertions, 0 deletions
diff --git a/docs/extensions/smarty.md b/docs/extensions/smarty.md
new file mode 100644
index 0000000..8c0d8cc
--- /dev/null
+++ b/docs/extensions/smarty.md
@@ -0,0 +1,78 @@
+title: SmartyPants Extension
+
+SmartyPants
+===========
+
+Summary
+-------
+
+The SmartyPants extension converts ASCII dashes, quotes and ellipses to
+their HTML entity equivalents.
+
+ASCII symbol | Replacements | HTML Entities | Substitution Keys
+------------ | --------------- | ------------------- | ----------------------------------------
+`'` | &lsquo; &rsquo; | `&lsquo;` `&rsquo;` | `'left-single-quote'`, `'right-single-quote'`
+`"` | &ldquo; &rdquo; | `&ldquo;` `&rdquo;` | `'left-double-quote'`, `'right-double-quote'`
+`<< >>` | &laquo; &raquo; | `&laquo;` `&raquo;` | `'left-angle-quote'`, `'right-angle-quote'`
+`...` | &hellip; | `&hellip;` | `'ellipsis'`
+`--` | &ndash; | `&ndash;` | `'ndash'`
+`---` | &mdash; | `&mdash;` | `'mdash'`
+
+Using the configuration option 'substitutions' you can overwrite the
+default substitutions. Just pass a dict mapping (a subset of) the
+keys to the substitution strings.
+
+For example, one might use the following configuration to get correct quotes for
+the German language:
+
+```python
+extension_configs = {
+ 'markdown.extensions.smarty': {
+ 'substitutions': {
+ 'left-single-quote': '&sbquo;', # sb is not a typo!
+ 'right-single-quote': '&lsquo;',
+ 'left-double-quote': '&bdquo;',
+ 'right-double-quote': '&ldquo;'
+ }
+ }
+}
+```
+
+!!! note
+ This extension re-implements the Python [SmartyPants]
+ library by integrating it into the markdown parser.
+ While this does not provide any additional features,
+ it does offer a few advantages. Notably, it will not
+ try to work on highlighted code blocks (using the
+ [CodeHilite] Extension) like the third party library
+ has been known to do.
+
+[SmartyPants]: http://pythonhosted.org/smartypants/
+[CodeHilite]: code_hilite.html
+
+Usage
+-----
+
+See [Extensions](index.md) for general extension usage, specify
+`markdown.extensions.smarty` as the name of the extension.
+
+See the [Library Reference](../reference.md#extensions) for information about
+configuring extensions.
+
+The following options are provided to configure the output:
+
+Option | Default value | Description
+------ | ------------- | -----------
+`smart_dashes` | `True` | whether to convert dashes
+`smart_quotes` | `True` | whether to convert straight quotes
+`smart_angled_quotes` | `False` | whether to convert angled quotes
+`smart_ellipses` | `True` | whether to convert ellipses
+`substitutions` | `{}` | overwrite default substitutions
+
+Further reading
+---------------
+
+SmartyPants extension is based on the original SmartyPants implementation
+by John Gruber. Please read it's [documentation][1] for details.
+
+[1]: http://daringfireball.net/projects/smartypants/