File: abbreviations.md

package info (click to toggle)
python-markdown 3.7-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,128 kB
  • sloc: python: 11,989; makefile: 66; sh: 7
file content (70 lines) | stat: -rw-r--r-- 1,703 bytes parent folder | download | duplicates (2)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
title: Abbreviations Extension

Abbreviations
=============

Summary
-------

The Abbreviations extension adds the ability to define abbreviations.
Specifically, any defined abbreviation is wrapped in  an `<abbr>` tag.

The Abbreviations extension is included in the standard Markdown library.

Syntax
------

Abbreviations are defined using the syntax established in
[PHP Markdown Extra][php].

[php]: http://www.michelf.com/projects/php-markdown/extra/#abbr

Thus, the following text (taken from the above referenced PHP documentation):

```md
The HTML specification
is maintained by the W3C.

*[HTML]: Hyper Text Markup Language
*[W3C]:  World Wide Web Consortium
```

will be rendered as:

```html
<p>The <abbr title="Hyper Text Markup Language">HTML</abbr> specification
is maintained by the <abbr title="World Wide Web Consortium">W3C</abbr>.</p>
```

The backslash (`\`) is not permitted in an abbreviation. Any abbreviation
definitions which include one or more backslashes between the square brackets
will not be recognized as an abbreviation definition.

Usage
-----

See [Extensions](index.md) for general extension usage. Use `abbr` as the name
of the extension.

The following options are provided to configure the output:

* **`glossary`**:
    A dictionary where the `key` is the abbreviation and the `value` is the definition.

A trivial example:

```python
markdown.markdown(some_text, extensions=['abbr'])
```

Disabling Abbreviations
-----------------------

When using the `glossary` option, there may be times when you need to turn off
a specific abbreviation. To do this, set the abbreviation to `''` or `""`.

```md
The HTML abbreviation is disabled on this page.

*[HTML]: ''
```