Debian Codegraph @

docs/extensions/abbreviations.md

raw
1 title: Abbreviations Extension
2
3 Abbreviations
4 =============
5
6 Summary
7 -------
8
9 The Abbreviations extension adds the ability to define abbreviations.
10 Specifically, any defined abbreviation is wrapped in an `<abbr>` tag.
11
12 The Abbreviations extension is included in the standard Markdown library.
13
14 !!! Note
15
16 This extension is in __maintenance mode__. We will continue to fix bugs
17 and keep it up-to-date with the core parser, but no new features or
18 changes in behavior will be made. If you need a feature that this
19 extension does not offer, then you have three options (1) find an
20 existing [third-party extension] which meets your needs, (2) [build your
21 own extension], or (3) fork this extension (pursuant to its licensing
22 requirements) and maintain it as a third-party extension.
23
24 [third-party extension]: index.md#third-party-extensions
25 [build your own extension]: api.md
26
27 Syntax
28 ------
29
30 Abbreviations are defined using the syntax established in
31 [PHP Markdown Extra][php].
32
33 [php]: http://www.michelf.com/projects/php-markdown/extra/#abbr
34
35 Thus, the following text (taken from the above referenced PHP documentation):
36
37 ```md
38 The HTML specification
39 is maintained by the W3C.
40
41 *[HTML]: Hyper Text Markup Language
42 *[W3C]: World Wide Web Consortium
43 ```
44
45 will be rendered as:
46
47 ```html
48 <p>The <abbr title="Hyper Text Markup Language">HTML</abbr> specification
49 is maintained by the <abbr title="World Wide Web Consortium">W3C</abbr>.</p>
50 ```
51
52 The backslash (`\`) is not permitted in an abbreviation. Any abbreviation
53 definitions which include one or more backslashes between the square brackets
54 will not be recognized as an abbreviation definition.
55
56 Usage
57 -----
58
59 See [Extensions](index.md) for general extension usage. Use `abbr` as the name
60 of the extension.
61
62 The following options are provided to configure the output:
63
64 * **`glossary`**:
65 A dictionary where the `key` is the abbreviation and the `value` is the definition.
66
67 A trivial example:
68
69 ```python
70 markdown.markdown(some_text, extensions=['abbr'])
71 ```
72
73 Disabling Abbreviations
74 -----------------------
75
76 When using the `glossary` option, there may be times when you need to turn off
77 a specific abbreviation. To do this, set the abbreviation to `''` or `""`.
78
79 ```md
80 The HTML abbreviation is disabled on this page.
81
82 *[HTML]: ''
83 ```