Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: third_party/markdown/extensions/nl2br.py

Issue 93743005: Support markdown template for html editor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix path without dir Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/markdown/extensions/meta.py ('k') | third_party/markdown/extensions/sane_lists.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 """
2 NL2BR Extension
3 ===============
4
5 A Python-Markdown extension to treat newlines as hard breaks; like
6 GitHub-flavored Markdown does.
7
8 Usage:
9
10 >>> import markdown
11 >>> print markdown.markdown('line 1\\nline 2', extensions=['nl2br'])
12 <p>line 1<br />
13 line 2</p>
14
15 Copyright 2011 [Brian Neal](http://deathofagremmie.com/)
16
17 Dependencies:
18 * [Python 2.4+](http://python.org)
19 * [Markdown 2.1+](http://packages.python.org/Markdown/)
20
21 """
22
23 from __future__ import absolute_import
24 from __future__ import unicode_literals
25 from . import Extension
26 from ..inlinepatterns import SubstituteTagPattern
27
28 BR_RE = r'\n'
29
30 class Nl2BrExtension(Extension):
31
32 def extendMarkdown(self, md, md_globals):
33 br_tag = SubstituteTagPattern(BR_RE, 'br')
34 md.inlinePatterns.add('nl', br_tag, '_end')
35
36
37 def makeExtension(configs=None):
38 return Nl2BrExtension(configs)
OLDNEW
« no previous file with comments | « third_party/markdown/extensions/meta.py ('k') | third_party/markdown/extensions/sane_lists.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698