Skip to content

Commit 54a00d1

Browse files
author
Waylan Limberg
committed
2 parents 6aa1846 + f7cb43f commit 54a00d1

File tree

6 files changed

+90
-32
lines changed

6 files changed

+90
-32
lines changed

docs/_template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ <h3>This Page</h3>
6262
<h3>Navigation</h3>
6363
<ul>
6464
<li class="right" style="margin-right: 10px">
65-
<a href="siteindex.html" title="General Index">index</a></li>
65+
<a href="%(base)ssiteindex.html" title="General Index">index</a></li>
6666
<li class="right">
6767
<a href="%(next_url)s" title="%(next_title)s"
6868
accesskey="N">next</a> |</li>

docs/basic.css

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -246,18 +246,21 @@ div.body p.centered {
246246

247247
/* -- tables ---------------------------------------------------------------- */
248248

249-
table.docutils {
249+
table {
250250
border: 0 solid #dce;
251251
border-collapse: collapse;
252252
}
253253

254-
table.docutils td, table.docutils th {
254+
table td, table th {
255255
padding: 2px 5px 2px 5px;
256-
border-left: 0;
257-
background-color: #eef;
258256
}
259257

260-
table.docutils td p.last, table.docutils th p.last {
258+
table td {
259+
border: 1px solid #ddd;
260+
background-color: #eef;
261+
}
262+
263+
table td p.last, table th p.last {
261264
margin-bottom: 0;
262265
}
263266

@@ -269,8 +272,8 @@ table.footnote td, table.footnote th {
269272
border: 0 !important;
270273
}
271274

272-
table.docutils th {
273-
border-top: 1px solid #cac;
275+
table th {
276+
border: 1px solid #cac;
274277
background-color: #ede;
275278
}
276279

@@ -280,7 +283,7 @@ th {
280283
}
281284

282285
th.head {
283-
text-align: center;
286+
text-align: center;
284287
}
285288

286289
/* -- other body styles ----------------------------------------------------- */
@@ -371,6 +374,10 @@ pre {
371374
overflow-y: hidden;
372375
}
373376

377+
code {
378+
font-size: 1.1em;
379+
}
380+
374381
td.linenos pre {
375382
padding: 5px 0px;
376383
border: 0;

docs/extensions/attr_list.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ The above results in the following output:
7373
To define attributes on inline elements, the attribute list should be defined
7474
immediately after the inline element with no whitespace.
7575

76-
[link](http://example.com){: class="foo bar" title="Some title! }
76+
[link](http://example.com){: class="foo bar" title="Some title!" }
7777

7878
The above results in the following output:
7979

docs/extensions/index.txt

Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ actual source files.
1515
To use an extension, pass it's name to markdown with the `extensions` keyword.
1616
See the [Library Reference](../reference.html#extensions) for more details.
1717

18-
markdown.markdown(some_text, extensions=['extra', 'nl2br'])
18+
markdown.markdown(some_text, extensions=['footnotes', 'nl2br'])
1919

2020
From the command line, specify an extension with the `-x` option. See the
2121
[Command Line docs](../cli.html) or use the `--help` option for more details.
2222

23-
python -m markdown -x extra input.txt > output.html
23+
python -m markdown -x footnotes -x tables input.txt > output.html
2424

2525
Officially Supported Extensions
2626
-------------------------------
@@ -31,23 +31,57 @@ maintained here and all bug reports should be made to the project. If you
3131
have a typical install of Python-Markdown, these extensions are already
3232
available to you.
3333

34-
* [Extra](extra.html)
35-
* [Abbreviations](abbreviations.html)
36-
* [Attribute Lists](attr_list.html)
37-
* [Definition Lists](definition_lists.html)
38-
* [Fenced Code Blocks](fenced_code_blocks.html)
39-
* [Footnotes](footnotes.html)
40-
* [Tables](tables.html)
41-
* [Smart Strong](smart_strong.html)
42-
* [CodeHilite](code_hilite.html)
43-
* [HTML Tidy](html_tidy.html)
44-
* [HeaderId](header_id.html)
45-
* [Meta-Data](meta_data.html)
46-
* [New Line to Break](nl2br.html)
47-
* [RSS](rss.html)
48-
* [Sane Lists](sane_lists.html)
49-
* [Table of Contents](toc.html)
50-
* [WikiLinks](wikilinks.html)
34+
### Markdown Extra
35+
36+
You can enable **all** these extensions just as if it was a single
37+
`extra` extension. Example:
38+
39+
markdown.markdown(some_text, extensions=['extra', 'codehilite'])
40+
41+
Extension | Name in Python-Markdown
42+
--------- | -----------------------
43+
[Abbreviations][] | `abbr`
44+
[Attribute Lists][] | `attr_list`
45+
[Definition Lists][] | `def_list`
46+
[Fenced Code Blocks][] | `fenced_code`
47+
[Footnotes][] | `footnotes`
48+
[Tables][] | `tables`
49+
[Smart Strong][] | `smart_strong`
50+
51+
[Abbreviations]: abbreviations.html
52+
[Attribute Lists]: attr_list.html
53+
[Definition Lists]: definition_lists.html
54+
[Fenced Code Blocks]: fenced_code_blocks.html
55+
[Footnotes]: footnotes.html
56+
[Tables]: tables.html
57+
[Smart Strong]: smart_strong.html
58+
59+
### Other extensions
60+
61+
There are also some extensions that are not included in Markdown Extra
62+
but come in the standard Python-Markdown library.
63+
64+
Extension | Name in Python-Markdown
65+
--------- | -----------------------
66+
[CodeHilite][] | `codehilite`
67+
[HTML Tidy][] | `html_tidy`
68+
[HeaderId] | `headerid`
69+
[Meta-Data] | `meta`
70+
[New Line to Break] | `nl2br`
71+
[RSS] | `rss`
72+
[Sane Lists] | `sane_lists`
73+
[Table of Contents] | `toc`
74+
[WikiLinks] | `wikilinks`
75+
76+
[CodeHilite]: code_hilite.html
77+
[HTML Tidy]: html_tidy.html
78+
[HeaderId]: header_id.html
79+
[Meta-Data]: meta_data.html
80+
[New Line to Break]: nl2br.html
81+
[RSS]: rss.html
82+
[Sane Lists]: sane_lists.html
83+
[Table of Contents]: toc.html
84+
[WikiLinks]: wikilinks.html
5185

5286
Third Party Extensions
5387
----------------------

markdown/extensions/fenced_code.py

100755100644
File mode changed.

markdown/inlinepatterns.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,27 @@ def unescape(self, text):
189189
stash = self.markdown.treeprocessors['inline'].stashed_nodes
190190
except KeyError:
191191
return text
192+
def itertext(el):
193+
' Reimplement Element.itertext for older python versions '
194+
tag = el.tag
195+
if not isinstance(tag, basestring) and tag is not None:
196+
return
197+
if el.text:
198+
yield el.text
199+
for e in el:
200+
for s in itertext(e):
201+
yield s
202+
if e.tail:
203+
yield e.tail
192204
def get_stash(m):
193205
id = m.group(1)
194206
if id in stash:
195-
return stash.get(id)
207+
value = stash.get(id)
208+
if isinstance(value, basestring):
209+
return value
210+
else:
211+
# An etree Element - return text content only
212+
return ''.join(itertext(value))
196213
return util.INLINE_PLACEHOLDER_RE.sub(get_stash, text)
197214

198215

@@ -371,7 +388,7 @@ def handleMatch(self, m):
371388
else:
372389
truealt = m.group(2)
373390

374-
el.set('alt', truealt)
391+
el.set('alt', self.unescape(truealt))
375392
return el
376393

377394
class ReferencePattern(LinkPattern):
@@ -416,7 +433,7 @@ def makeTag(self, href, title, text):
416433
el.set("src", self.sanitize_url(href))
417434
if title:
418435
el.set("title", title)
419-
el.set("alt", text)
436+
el.set("alt", self.unescape(text))
420437
return el
421438

422439

0 commit comments

Comments
 (0)