Debian Codegraph @

docs/extensions/nl2br.md

raw
1 title: New Line to Break Extension
2
3 New-Line-to-Break Extension
4 ===========================
5
6 Summary
7 -------
8
9 The New-Line-to-Break (`nl2br`) Extension will cause newlines to be treated as
10 hard breaks; like StackOverflow and [GitHub][] flavored Markdown do.
11
12 [Github]: https://github.github.com/github-flavored-markdown/
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 Example
28 -------
29
30 ```pycon
31 >>> import markdown
32 >>> text = """
33 ... Line 1
34 ... Line 2
35 ... """
36 >>> html = markdown.markdown(text, extensions=['nl2br'])
37 >>> print html
38 <p>Line 1<br />
39 Line 2</p>
40 ```
41
42 Usage
43 -----
44
45 See [Extensions](index.md) for general extension usage. Use `nl2br` as the name
46 of the extension.
47
48 This extension does not accept any special configuration options.
49
50 A trivial example:
51
52 ```python
53 markdown.markdown(some_text, extensions=['nl2br'])
54 ```