Giter Site home page Giter Site logo

python-markdown2's Introduction

Markdown is a light text markup format and a processor to convert that to HTML. The originator describes it as follows:

Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).

-- http://daringfireball.net/projects/markdown/

This (markdown2) is a fast and complete Python implementation of Markdown. It was written to closely match the behaviour of the original Perl-implemented Markdown.pl. Markdown2 also comes with a number of extensions (called "extras") for things like syntax coloring, tables, header-ids. See the "Extra Syntax" section below. "markdown2" supports all Python versions 3.5+ (and pypy and jython, though I don't frequently test those).

There is another Python markdown.py. However, at least at the time this project was started, markdown2.py was faster (see the Performance Notes) and, to my knowledge, more correct (see Testing Notes). That was a while ago though, so you shouldn't discount Python-markdown from your consideration.

Follow @trentmick for updates to python-markdown2.

Install

To install it in your Python installation run one of the following:

pip install markdown2
pip install markdown2[all]  # to install all optional dependencies (eg: Pygments for code syntax highlighting)
pypm install markdown2      # if you use ActivePython (activestate.com/activepython)
easy_install markdown2      # if this is the best you have
python setup.py install

However, everything you need to run this is in "lib/markdown2.py". If it is easier for you, you can just copy that file to somewhere on your PythonPath (to use as a module) or executable path (to use as a script).

Quick Usage

As a module:

>>> import markdown2
>>> markdown2.markdown("*boo!*")  # or use `html = markdown_path(PATH)`
'<p><em>boo!</em></p>\n'

>>> from markdown2 import Markdown
>>> markdowner = Markdown()
>>> markdowner.convert("*boo!*")
'<p><em>boo!</em></p>\n'
>>> markdowner.convert("**boom!**")
'<p><strong>boom!</strong></p>\n'

As a script (CLI):

$ python markdown2.py foo.md > foo.html

or

$ python -m markdown2 foo.md > foo.html

I think pip-based installation will enable this as well:

$ markdown2 foo.md > foo.html

See the project wiki, lib/markdown2.py docstrings and/or python markdown2.py --help for more details.

Extra Syntax (aka extensions)

Many Markdown processors include support for additional optional syntax (often called "extensions") and markdown2 is no exception. With markdown2 these are called "extras". Using the "footnotes" extra as an example, here is how you use an extra ... as a module:

$ python markdown2.py --extras footnotes foo.md > foo.html

as a script:

>>> import markdown2
>>> markdown2.markdown("*boo!*", extras=["footnotes"])
'<p><em>boo!</em></p>\n'

There are a number of currently implemented extras for tables, footnotes, syntax coloring of <pre>-blocks, auto-linking patterns, table of contents, Smarty Pants (for fancy quotes, dashes, etc.) and more. See the Extras wiki page for full details.

Project

The python-markdown2 project lives at https://github.com/trentm/python-markdown2/. (Note: On Mar 6, 2011 this project was moved from Google Code to here on Github.) See also, markdown2 on the Python Package Index (PyPI).

The change log: https://github.com/trentm/python-markdown2/blob/master/CHANGES.md

To report a bug: https://github.com/trentm/python-markdown2/issues

Contributing

We welcome pull requests from the community. Please take a look at the TODO for opportunities to help this project. For those wishing to submit a pull request to python-markdown2 please ensure it fulfills the following requirements:

  • It must pass PEP8.
  • It must include relevant test coverage.
  • Bug fixes must include a regression test that exercises the bug.
  • The entire test suite must pass.
  • The README and/or docs are updated accordingly.

Test Suite

This markdown implementation passes a fairly extensive test suite. To run it:

make test

The crux of the test suite is a number of "cases" directories -- each with a set of matching .text (input) and .html (expected output) files. These are:

tm-cases/                   Tests authored for python-markdown2 (tm=="Trent Mick")
markdowntest-cases/         Tests from the 3rd-party MarkdownTest package
php-markdown-cases/         Tests from the 3rd-party MDTest package
php-markdown-extra-cases/   Tests also from MDTest package

See the Testing Notes wiki page for full details.

python-markdown2's People

Contributors

alanhamlett avatar andrenasturas avatar cdman avatar codebykat avatar crozzers avatar ewankirk avatar hmagdy avatar hugovk avatar joestump avatar keysona avatar m417z avatar malcolmr avatar marios-zindilis avatar mdhowle avatar mhils avatar momja avatar msabramo avatar navanchauhan avatar nicholasserra avatar oz123 avatar polarkac avatar ryanvilbrandt avatar shaunbrady avatar slomo avatar starry-shivam avatar taylan avatar tgray avatar thombashi avatar trentm avatar venthur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-markdown2's Issues

[shadow] conversion problem with this embedded raw HTML

_This is a _shadow issue* for Issue 41 on Google Code (from which this project was moved).
Added 2010-06-09T17:06:09.000Z by [email protected].
Labels: Type-Defect, Priority-High.
Please make updates to the bug there.*

Original description

markdown2.py doesn't get all the &quot;# ...&quot; h1's in the following. Markdown.pl doesn't either. The version (old) of markdown.py that I have does get this right:

{{{
<style>
h1 {
    border-top: 3px solid #ccc;
    padding: 10px 0;
    margin: 40px 0 10px 0; 
}
</style>

# `.as_font_swiss921` (Swiss 921 BT Regular A)

<div class=&quot;as_font_swiss921&quot; style=&quot;font-size: 36px;&quot;>Active<span class=&quot;as_brand_red&quot;>State</span></div>

<div class=&quot;as_font_swiss921&quot;>Active<span class=&quot;as_brand_red&quot;>State</span> Code</div>

<div class=&quot;as_font_swiss921&quot;>trent<span class=&quot;as_brand_red&quot;>m</span>@active<span class=&quot;as_brand_red&quot;>state</span>.com</div>
<div class=&quot;as_font_swiss921&quot;>Trent<span class=&quot;as_brand_red&quot;>M</span>@Active<span class=&quot;as_brand_red&quot;>State</span>.com</div>



# `.as_font_swiss721cnbold` (Swiss 721 BT Condensed Bold)

<div class=&quot;as_font_swiss721cnbold&quot; style=&quot;font-size: 36px;&quot;>Active<span class=&quot;as_brand_red&quot;>State</span></div>

<div class=&quot;as_font_swiss721cnbold&quot;>Active<span class=&quot;as_brand_red&quot;>State</span> Code</div>

<div class=&quot;as_font_swiss721cnbold&quot;>trent<span class=&quot;as_brand_red&quot;>m</span>@active<span class=&quot;as_brand_red&quot;>state</span>.com</div>
<div class=&quot;as_font_swiss721cnbold&quot;>Trent<span class=&quot;as_brand_red&quot;>M</span>@Active<span class=&quot;as_brand_red&quot;>State</span>.com</div>



# ActiveState dev'y site banner comparisons

<div style=&quot;padding: 50px; background-color: #056c84&quot;>
  <div><img src=&quot;img/as_code.png&quot;> # image</div>
  <div><span class=&quot;as_font_swiss721cnbold as_banner_text&quot;>ActiveState Code</span> # web font</div>
</div>
}}}

[shadow] Will not markdown emails with underlines

_This is a _shadow issue* for Issue 26 on Google Code (from which this project was moved).
Added 2009-06-03T22:05:13.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

<b>What steps will reproduce the problem?</b>
1. import markdown2
2. markdown2.markdown('<[email protected]>')
3. Output: u'<p><[email protected]></p>\n'

<b>What is the expected output? What do you see instead?</b>
I would have expected to get an encoded email address.

<b>What version of the product are you using? On what operating system?</b>
ubuntu 9.04 with python 2.5.4 with markdown2 1.0.1.12a (r183)

[shadow] support older versions of Python

_This is a _shadow issue* for Issue 4 on Google Code (from which this project was moved).
Added 2007-11-04T22:19:15.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

Currently markdown2.py requires a very recent version of Python (possibly
>=2.5).

This email indicates that this isn't ideal:

> Hi Trent. Is it possible to run this from the BBEdit Unix Filters
> menu? I've just dropped it into the right folder, but running it on a
> text selection gives this:
> 
> Syntax error line 88. Invalid syntax:
> 
>                        for ch in '\\`*_{}[]()>#+-.!')
> 

[shadow] footnotes don't work when ref is capitalized

_This is a _shadow issue* for Issue 6 on Google Code (from which this project was moved).
Added 2007-11-08T18:34:19.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

DESCRIPTION:

Only uncapitalized footnote references seem to work (e.g., [^foot] not 
[^Foot])Footnote references should be allowed to be capitalized. Maruku, 
for example allows this. Or am I missing something?

THIS TEXT:

Here is some text [^Foot]

[^Foot]: This should be a footnote

PRODUCES:

p>Here is some text [^Foot]</p>

<div class=&quot;footnotes&quot;>
<hr />
<ol>
</ol>
</div>

IT SHOULD PRODUCE:

<p>Here is some text <sup class=&quot;footnote-ref&quot; id=&quot;fnref-Foot&quot;><a 
href=&quot;#fn-Foot&quot;>1</a></sup></p>

<div class=&quot;footnotes&quot;>
<hr />
<ol>
<li id=&quot;fn-Foot&quot;>
<p>This should be a footnote&nbsp;<a href=&quot;#fnref-Foot&quot; 
class=&quot;footnoteBackLink&quot; title=&quot;Jump back to footnote 1 in the 
text.&quot;>&#8617;</a></p>
</li>
</ol>
</div>

[shadow] traceback if non-existant file on cmdline

_This is a _shadow issue* for Issue 47 on Google Code (from which this project was moved).
Added 2010-09-18T09:25:24.000Z by [email protected].
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

From https://bugzilla.redhat.com/show_bug.cgi?id=633529:

The user called &quot;markdown2 OVERVIEW.md test.html&quot;. Seems the intention was to generate test.html.

Surely it would have been correct to redirect, like this: &quot;markdown2 OVERVIEW.md > test.html&quot;.

Nevertheless, a nice error message instead of a traceback would be preferred.

[shadow] Bug with Links using javascript:... in href attribute

_This is a _shadow issue* for Issue 18 on Google Code (from which this project was moved).
Added 2008-04-30T09:28:35.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-High.
Please make updates to the bug there.*

Original description

Hello,

I produce text files from html-files using the html2text python script from
Aaron Swartz (http://www.aaronsw.com/2002/html2text/). When using it on the
page http://www.sptimes.ru/index.php?action_id=1&i_number=1241 there are
some links your regexp doesn't match (see attached file, eg. link number
10, 86).

I have gently adapted the expression:
  a) the line with # url = \2: 
      Allow for any charachter in URL (also spaces)
  b) the line with # title = \3: 
      Allow for empty title strings (i.e. empty brackets)

My version of the regular expression:
_link_def_re = re.compile(r&quot;&quot;&quot;
            ^[ ]{0,%d}\[(.+)\]: # id = \1
              [ \t]*
              \n?               # maybe *one* newline
              [ \t]*
            <?(.+?)>?          # url = \2
              [ \t]*
              \n?               # maybe one newline
              [ \t]*
            (?:
                (?<=\s)         # lookbehind for whitespace
                ['&quot;(]
                (.*?)           # title = \3 (allow empty titles)
                ['&quot;)]
                [ \t]*
            )?  # title is optional
            (?:\n+|\Z)
            &quot;&quot;&quot; % less_than_tab, re.X | re.M)

Maybe you could give it a thought if it is worth to add this to the code.

regards
Johannes Fitz 

[shadow] markup not processed in footnotes

_This is a _shadow issue* for Issue 11 on Google Code (from which this project was moved).
Added 2007-12-05T07:07:36.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

<b>What steps will reproduce the problem?</b>
1. >>> m = markdown2.Markdown(extras=['footnotes'])
2. >>> m.convert('hi.[^1]\n[^1]: A _note_.')
<b>3.</b>

<b>What is the expected output? What do you see instead?</b>

Output for footnote should be

   <ol>\n<li id=&quot;fn-1&quot;>\n<p>A <em>note</em>. ...

or

   <ol>\n<li id=&quot;fn-1&quot;>A <em>note</em>. ...

but is

   <ol>\n<li id=&quot;fn-1&quot;>\n<p>A _note_. ...


<b>What version of the product are you using? On what operating system?</b>

r107, OS X

<b>Please provide any additional information below.</b>

I've only verified that this is a problem with markdown characters _ and *.

[shadow] safe_mode=True seems to postprocess generated HTML

_This is a _shadow issue* for Issue 2 on Google Code (from which this project was moved).
Added 2007-11-03T11:12:00.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-High.
Please make updates to the bug there.*

Original description

Markdown successfully processes this snippet with safe_mode=False:

    markdown('## Heading 2\n', safe_mode=False)

However with safe_mode=True it seems to kill its own generated HTML:

    >>>> markdown('## Heading 2\n', safe_mode=True)
    '[HTML_REMOVED]\n'

[shadow] markdown Extension

_This is a _shadow issue* for Issue 28 on Google Code (from which this project was moved).
Added 2009-09-09T07:57:22.000Z by lwkyykk.
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

can you do it?

[javascript]
alert(&quot;Hello Word!&quot;)

txt to html:

<pre class=&quot;javascript&quot;>
alert(&quot;Hello Word!&quot;)
</pre>

eg:http://www.symfony-project.org/jobeet/1_2/Propel/zh_CN/07

python-markdown2 be able to do that?

[shadow] Annoying conversion of long_file_name to long<em>file</em>name (intra-word emphasis)

_This is a _shadow issue* for Issue 38 on Google Code (from which this project was moved).
Added 2010-05-28T02:53:47.000Z by samtaufa.
Labels: Type-Enhancement, Priority-Medium.
Please make updates to the bug there.*

Original description

Started using markdown2 and one of my faults with the conversion is that we
use a lot of long_file_names_with_underscores.

Unfortunately, this causes the generated pages to look real wacky with
italics happening in unexpected places, and variables  and filenames not
being correct.

The change was to wrap the re.compile sequences in markdown2.py with &quot;\b&quot;
as per the below example.
Index: lib/markdown2.py
===================================================================
--- lib/markdown2.py    (revision 248)
+++ lib/markdown2.py    (working copy)
@@ -1408,10 +1408,10 @@
             text = text.replace(before, after)
         return text

-    _strong_re = re.compile(r&quot;(\*\*|__)(?=\S)(.+?[*_]*)(?<=\S)\1&quot;, re.S)
-    _em_re = re.compile(r&quot;(\*|_)(?=\S)(.+?)(?<=\S)\1&quot;, re.S)
-    _code_friendly_strong_re =
re.compile(r&quot;\*\*(?=\S)(.+?[*_]*)(?<=\S)\*\*&quot;, re.S)
-    _code_friendly_em_re = re.compile(r&quot;\*(?=\S)(.+?)(?<=\S)\*&quot;, re.S)
+    _strong_re = re.compile(r&quot;\b(\*\*|__)(?=\S)(.+?[*_]*)(?<=\S)\1\b&quot;, re.S)
+    _em_re = re.compile(r&quot;\b(\*|_)(?=\S)(.+?)(?<=\S)\1\b&quot;, re.S)
+    _code_friendly_strong_re =
re.compile(r&quot;\b\*\*(?=\S)(.+?[*_]*)(?<=\S)\*\*\b&quot;, re.S)
+    _code_friendly_em_re = re.compile(r&quot;\b\*(?=\S)(.+?)(?<=\S)\*\b&quot;, re.S)
     def _do_italics_and_bold(self, text):
         # <strong> must go first:
         if &quot;code-friendly&quot; in self.extras:
I'm not sure if this is an acceptable change, since the 'standard' seems to
be ambiguous(?) about the expected behaviour ?


Hope this helps,


Sam T.

[shadow] "img sizes" patch from James Eagan

_This is a _shadow issue* for Issue 10 on Google Code (from which this project was moved).
Added 2007-11-28T04:51:21.000Z by [email protected].
Labels: Type-Enhancement, Priority-Low.
Please make updates to the bug there.*

Original description

James wrote:

[A patch] to automatically calculate image sizes and insert
them into the generated HTML (see the attached patch, made off the svn
trunk).  Whenever it's about to write an HTML <img> tag, it checks if
the url is relative or absolute.  If it's absolute, it loads the URL
and tries to calculate the dimensions of the image.  If it's relative,
it checks to see if a file exists on the local filesystem relative to
the current working directory and uses that for the size.  Whenever it
can't find the size, it omits the width and height attributes, falling
back to the existing behavior.

This patch uses two approaches for calculating image sizes.  First, it
tries to use Cocoa's NSImage on the Mac.  Of course, this will fail on
non-Macs, so it then falls back to trying to use the Python Imaging
Library (PIL).  (I don't use PIL first, since it is sometimes compiled
without PNG or JPEG support.)  Finally, if none of those libraries is
available, it just reverts to the current behavior, omitting the size
attributes.

Please feel free to use this patch as you see fit.  I have not written
any test cases for it, nor have I given it any sort of a rigorous
quality assurance.  It works for me on my machine with my input files,
but I haven't tried it under any other setup.

[shadow] script confuses <p> and <h#> when both are valid

_This is a _shadow issue* for Issue 35 on Google Code (from which this project was moved).
Added 2010-04-07T15:39:13.000Z by [email protected]. Closed (Invalid).
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

<b>What steps will reproduce the problem?</b>
1. create a txt file that contains a &quot;list of headers&quot;, e.g.

# Header 1 

# Header 2 

# Header 3 

# Header 4

2. Read in text as string and process with python-markdown2

<b>What is the expected output? What do you see instead?</b>
Expected:

<h1> Header 1 </h1>

<h1> Header 2 </h1>

<h1> Header 3 </h1>

<h1> Header 4 </h1>

Actual:

<h1>Header 1</h1>

<p># Header 2</p>

<p># Header 3</p>

<p># Header 4</p>

<b>What version of the product are you using? On what operating system?</b>

1.0.1.16

<b>Please provide any additional information below.</b>

[shadow] conversion problem with this embedded raw HTML (2)

_This is a _shadow issue* for Issue 44 on Google Code (from which this project was moved).
Added 2010-08-30T18:41:41.000Z by [email protected].
Labels: Type-Defect, Priority-High.
Please make updates to the bug there.*

Original description

{{{
#22 builds of Komodo

<img style=&quot;width: 150px; height: 134px; margin: 0 5px 5px 0; float: left;&quot; src=&quot;22-builds-of-komodo.png&quot; alt=&quot;Komodo heart LA Zoo&quot;>
</img>

Last Thursday the LA Zoo & Botanical Gardens
[tweeted](http://twitter.com/LAZoo/status/22106438732) that they'd
successfully hatched 22 Komodo dragons ([more
info](http://www.lazoo.org/about/press/0810/0825komodos.html)). That's
awesome! Congratulations to the Zoo staff on their efforts. In celebration,
**we'll donate 20% of all [Komodo
IDE](http://www.activestate.com/komodo-ide) sales for Tuesday, Aug 31st
to the LA Zoo.**
}}}

The img tag gets all screwed up. Tried both with and without the close `</img>`

{{{
<h3>22 builds of Komodo</h3>

<p><img style=&quot;width: 150px; height: 134px; margin: 0 5px 5px 0; float: left;&#8221; src=&quot;22-builds-of-komodo.png&#8221; alt=&quot;Komodo heart LA Zoo&quot;>
</img></p>

<p>Last Thursday the LA Zoo &amp; Botanical Gardens
<a href=&quot;http://twitter.com/LAZoo/status/22106438732&quot;>tweeted</a> that they&#8217;d
successfully hatched 22 Komodo dragons (<a href=&quot;http://www.lazoo.org/about/press/0810/0825komodos.html&quot;>more
info</a>). That&#8217;s
awesome! Congratulations to the Zoo staff on their efforts. In celebration,
<strong>we&#8217;ll donate 20% of all <a href=&quot;http://www.activestate.com/komodo-ide&quot;>Komodo
IDE</a> sales for Tuesday, Aug 31st
to the LA Zoo.</strong></p>
}}}
}}}

[shadow] list+code tags formatting bug

_This is a _shadow issue* for Issue 13 on Google Code (from which this project was moved).
Added 2008-01-22T12:54:55.000Z by vsevolod.balashov.
Labels: Type-Defect, Priority-High.
Please make updates to the bug there.*

Original description

markdown(&quot;* one\n* two\n\n    def func:\n        pass\n&quot;)

expected:
u'<ul>\n<li>one</li>\n<li>two</li>\n</ul>\n\n<pre><code>def func:\n   
pass\n</code></pre>\n'

actual:
u'<ul>\n<li>one</li>\n<li><p>two</p>\n\n<p>def func:\n   
pass</p></li>\n</ul>\n'

[shadow] request for way to handle a bulleted list cuddled with a preceding paragraph

_This is a _shadow issue* for Issue 33 on Google Code (from which this project was moved).
Added 2009-12-16T06:01:42.000Z by [email protected]. Closed (Fixed).
Labels: Type-Enhancement, Priority-Medium.
Please make updates to the bug there.*

Original description

Benjamin Smedberg wrote:
> A lot of people in weekly-updates put their status in like this:
>
> I did these things:
> * bullet1
> * bullet2
> * bullet3
>
> Markdown doesn't convert this to a bulleted list. Is this because there
> isn't an extra newline between the opening paragraph and the list? Is it
> possible to change that behavior, even as a special option or extension?
>
> --BDS

Answer: yes this is because there isn't a newline btwn the two. I can look 
into an &quot;extra&quot; for this.

[shadow] problems with bidi text? encodings etc.

_This is a _shadow issue* for Issue 3 on Google Code (from which this project was moved).
Added 2007-11-03T18:04:00.000Z by [email protected].
Labels: Type-Defect, Priority-High.
Please make updates to the bug there.*

Original description

[Trent, discussing markdown(1).py]
> Are there any test cases for that in the python-markdown repo? I'd
> appreciate a specific example. I'm relatively comfortable with unicode
> -- but haven't had any real experience with bidi text.

[Yuri]
> Yes, in tests/misc.  See japanese.txt, russian.txt, bidi.txt.


Take a look at those tests. Get the test suite to use those tests as well?

[shadow] case where parsing of link markdown doesn't get it right

_This is a _shadow issue* for Issue 40 on Google Code (from which this project was moved).
Added 2010-06-07T19:47:12.000Z by [email protected].
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

{{{
[Editor Note (June 2010): The above link no longer exists, it redirects to an inappropriate and unrelated site. The link has been updated to the Internet Archive version. See [all archived versions of this URL](http://web.archive.org/web/*/%20http://zxw.nm.ru/test_w_upload.py.htm).]
}}}

The above para isn't parsed properly. Currently get this HTML

{{{
<p>[Editor Note (June 2010): The above link no longer exists, it redirects to an inappropriate and unrelated site. The link has been updated to the Internet Archive version. See [all archived versions of this URL](http://web.archive.org/web/*/%20http://zxw.nm.ru/test<em>w</em>upload.py.htm).]</p>
}}}

[shadow] Escape non-ascii chars in urls

_This is a _shadow issue* for Issue 31 on Google Code (from which this project was moved).
Added 2009-10-08T09:52:12.000Z by [email protected].
Labels: Type-Defect, Priority-High.
Please make updates to the bug there.*

Original description

<b>What steps will reproduce the problem?</b>
1. import markdown2
2. markdown2.markdown(u'[link](http://example.com/тест)')

<b>What is the expected output? What do you see instead?</b>
now this produces following output: 
>>> u'<p><a href=&quot;http://example.com/\xd1\x82\xd0\xb5\xd1\x81\xd1\x82&quot;>link</a></p>\n'
it would be nice to see more standards compliant
>>> u'<p><a href=&quot;http://example.com/%D1%82%D0%B5%D1%81%D1%82&quot;>link</a></p>\n'

<b>What version of the product are you using? On what operating system?</b>
1.0.1.15 on ubuntu

<b>Please provide any additional information below.</b>
this can be done quite easily with urllib2.quote 

[shadow] Backslash-escapes aren't being handled properly

_This is a _shadow issue* for Issue 15 on Google Code (from which this project was moved).
Added 2008-02-16T01:27:25.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-High.
Please make updates to the bug there.*

Original description

http://daringfireball.net/projects/markdown/syntax.php#backslash

>>> from markdown2 import markdown
>>> markdown(r'\`This should not be in code.\`')
u'<p>\\<code>This should not be in code.\\</code></p>\n'

That is wrong.

c.f. &quot;[Python-markdown-discuss] Escape character and backtick bug.&quot; discussion

[shadow] r80 broke test 'markdown2/phpmarkdown/email_auto_links'

_This is a _shadow issue* for Issue 5 on Google Code (from which this project was moved).
Added 2007-11-06T06:40:48.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

r80 added the utf-8 encoding/decoding.

======================================================================
FAIL: markdown2/phpmarkdown/email_auto_links
----------------------------------------------------------------------
Traceback (most recent call last):
  File &quot;./test_markdown2.py&quot;, line 145, in <lambda>
    self._assertMarkdownPath(t, opts=o)
  File &quot;./test_markdown2.py&quot;, line 77, in _assertMarkdownPath
    self._assertMarkdown(text, html, text_path, html_path, opts=opts)
  File &quot;./test_markdown2.py&quot;, line 124, in _assertMarkdown
    errmsg.encode('ascii', 'charreprreplace'))
AssertionError: markdown2.py didn't produce the expected HTML:
  ---- text (escaping: .=space, \n=newline) ----
    <[email protected]>\n
    \n
    International.domain.names:.<help@t\u016bdali\u0146.lv>
  ---- Python markdown2.py HTML (escaping: .=space, \n=newline) ----

<p><a.href=&quot;&#109;&#x61;i&#108;&#x74;&#111;&#58;&#x6d;&#x69;&#99;&#x68;&#101;&#108;.&#102;&#x6f;&#114;&#x74;&#x69;&#110;&#64;&#x6d;&#x69;c&#x68;&#101;&#108;&#102;&#46;&#99;&#x6f;&#x6d;&quot;>&#x6d;&#x69;&#99;&#x68;&#101;&#108;.&#102;&#x6f;&#114;&#x74;&#x69;&#110;&#64;&#x6d;&#x69;c&#x68;&#101;&#108;&#102;&#46;&#99;&#x6f;&#x6d;</a></p>\n
    \n
    <p>International.domain.names:.<help@t\u016bdali\u0146.lv></p>\n
  ---- expected HTML (escaping: .=space, \n=newline) ----

<p><a.href=&quot;&#109;&#x61;&#105;&#x6c;&#116;&#x6f;&#58;&#x6d;&#105;&#x63;&#104;&#x65;&#108;&#x2e;&#102;&#x6f;&#114;&#x74;&#105;&#x6e;&#64;&#x6d;&#105;&#x63;&#104;&#x65;&#108;&#x66;&#46;&#x63;&#111;&#x6d;&quot;>&#x6d;&#105;&#x63;&#104;&#x65;&#108;&#x2e;&#102;&#x6f;&#114;&#x74;&#105;&#x6e;&#64;&#x6d;&#105;&#x63;&#104;&#x65;&#108;&#x66;&#46;&#x63;&#111;&#x6d;</a></p>\n
    \n

<p>International.domain.names:.<a.href=&quot;&#x6d;&#97;&#105;&#x6c;&#x74;&#111;&#58;&#x68;&#x65;&#108;&#112;&#x40;&#x74;\u016b&#x64;&#x61;&#108;&#105;\u0146&#46;&#108;&#x76;&quot;>&#x68;&#x65;&#108;&#112;&#x40;&#x74;\u016b&#x64;&#x61;&#108;&#105;\u0146&#46;&#108;&#x76;</a></p>\n
  ---- diff ----
    --- ./php-markdown-cases/Email auto links.html 
    +++ markdown2 ./php-markdown-cases/Email auto links.text 
    @@ -1,3 +1,3 @@
     <p><a
href=&quot;mailto:[email protected]&quot;>[email protected]</a></p>

    -<p>International domain names: <a
href=&quot;mailto:help@t\u016bdali\u0146.lv&quot;>help@t\u016bdali\u0146.lv</a></p>
    +<p>International domain names: <help@t\u016bdali\u0146.lv></p>

[shadow] Ability to use Markdown inside of HTML tags

_This is a _shadow issue* for Issue 17 on Google Code (from which this project was moved).
Added 2008-02-24T12:13:47.000Z by [email protected].
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

I would like to see the ability to have Markdown inside of HTML tags. On some of my websites, I 
wrap Markdown text in a <div> tag, like this:

<div>

# markdown goes here

</div>

This allows me to apply specific CSS styles to the text.

This worked using the original Markdown implementation:
>>> markdown.markdown('<div>\n\n# test\ntest\n\n</div>')
'\n<div>\n\n\n<h1>test</h1>\n<p>test\n</p>\n</div>\n\n\n\n'

However, using your implementation gives the following output:
>>> markdown2.markdown('<div>\n\n# test\ntest\n\n</div>')
u'<div>\n\n# test\ntest\n\n</div>\n'

I am not sure if this behaviour is intended, but it stops me from using Markdown2, so I would 
like to see this working.

[shadow] couple of extra letters break link parsing

_This is a _shadow issue* for Issue 24 on Google Code (from which this project was moved).
Added 2008-12-11T11:37:51.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

<b>What steps will reproduce the problem?</b>

1. from markdown2 import markdown as m

2. >>> m('[However installation of Kunnafonix was resisted by many of the local organizations they 
had to work with The local &quot;computer person&quot; resented a solution that was so easy to use that it 
undermined the power and prestige they received by being the person to consult when a Windows 
computer had problems](http://tuxdeluxe.org/node/287)')
u'<p>[However installation of Kunnafonix was resisted by many of the local organizations they had to 
work with The local &quot;computer person&quot; resented a solution that was so easy to use that it undermined 
the power and prestige they received by being the person to consult when a Windows computer had 
problems](http://tuxdeluxe.org/node/287)</p>\n'

3. >>> m('[wever installation of Kunnafonix was resisted by many of the local organizations they had to 
work with The local &quot;computer person&quot; resented a solution that was so easy to use that it undermined 
the power and prestige they received by being the person to consult when a Windows computer had 
problems](http://tuxdeluxe.org/node/287)')
u'<p><a href=&quot;http://tuxdeluxe.org/node/287&quot;>wever installation of Kunnafonix was resisted by 
many of the local organizations they had to work with The local &quot;computer person&quot; resented a solution 
that was so easy to use that it undermined the power and prestige they received by being the person to 
consult when a Windows computer had problems</a></p>\n'


<b>What is the expected output? What do you see instead?</b>

See, just removing few letters at the start of a string make it being parsed properly. Same result may be 
achieved by removing words in the middle of a sentence. I cannot see any sense in what triggers this 
bug :(

<b>What version of the product are you using? On what operating system?</b>
>>> markdown2.__version__
'1.0.1.11'

<b>Please provide any additional information below.</b>

[shadow] Escaping _ in footnotes does not work

_This is a _shadow issue* for Issue 27 on Google Code (from which this project was moved).
Added 2009-07-02T02:12:26.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

Using markdown2 1.0.1.12, with the footnotes extensions enabled, escaping underscores (_) in a 
footnote leaves an MD5 hash in its place.

Running the following through markdown2:
{{{
memcpy_from_tvm

Testing[^1], more testing [^2], more[^3].

[^1]: memcpy_from_tvm
[^2]: `memcpy_from_tvm`
[^3]: memcpy\_from\_tvm
}}}

using with and without code-friendly
{{{
markdown2 -x footnotes  md5_uh.markdown
markdown2 -x footnotes -x code-friendly md5_uh.markdown
}}}

Generates the following html for the footnotes that use escapes:
{{{
<p>memcpymd5-b14a7b8059d9c055954c92674ce60032frommd5-
b14a7b8059d9c055954c92674ce60032tvm&nbsp;<a href=&quot;#fnref-3&quot; class=&quot;footnoteBackLink&quot; 
title=&quot;Jump back to footnote 3 in the text.&quot;>&#8617;</a></p>
}}}

with code-friendly turned on the first footnote correctly does not generate <em>.

[shadow] Enhacement: Provide downloable tarball.

_This is a _shadow issue* for Issue 19 on Google Code (from which this project was moved).
Added 2008-09-15T19:11:55.000Z by [email protected]. Closed (Done).
Labels: Type-Enhancement, Priority-Medium.
Please make updates to the bug there.*

Original description

Being behind a proxy makes it impossible to do a checkout over plain HTTP, 
so it would be nice to be able to have python-markdown2 as a tarball/zip 
for download.

[shadow] allow link-patterns to set link attributes

_This is a _shadow issue* for Issue 50 on Google Code (from which this project was moved).
Added 2010-11-06T07:19:44.000Z by [email protected].
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

I use a project that makes use of link_patterns to automatically convert &quot;bug NNNN&quot; to a bug link. I would like those bug links to have their title attributes set (to the summary of the bug), but link_patterns currently only controls the href attribute.

I am attaching a patch that allows a callable value in the link_patterns to return a dict containing arbitrary attributes to add to the <a> tag.

For my specific usage example, see https://bugzilla.mozilla.org/show_bug.cgi?id=609736

[shadow] Additional options for code-color extension.

_This is a _shadow issue* for Issue 23 on Google Code (from which this project was moved).
Added 2008-11-13T13:00:19.000Z by [email protected]. Closed (Fixed).
Labels: Type-Enhancement, Priority-Medium.
Please make updates to the bug there.*

Original description

Here the patch, which allow to pass additional options to pygments highlighter.

For example, now you can tell it, to inline css styles or to add line numbers:

{{{
    extras = {&quot;code-color&quot;: {&quot;noclasses&quot;: True, 'linenos': True}}
}}}

[shadow] Escaped HTML instead of [HTML REMOVED] in safe mode

_This is a _shadow issue* for Issue 8 on Google Code (from which this project was moved).
Added 2007-11-10T10:29:14.000Z by [email protected]. Closed (Fixed).
Labels: Type-Enhancement, Priority-Medium.
Please make updates to the bug there.*

Original description

Would it make more sense to just escape HTML and display it instead of
replacing it with &quot;[HTML REMOVED]&quot;? This is not a big deal but it just
feels more correct to me.

[shadow] Duplicate column name error when the MarkupField is used in an abstract Model

_This is a _shadow issue* for Issue 32 on Google Code (from which this project was moved).
Added 2009-11-26T17:37:11.000Z by [email protected]. Closed (Invalid).
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

Consider two Models (News & Article) that derive from an abstract model
(Content). The MarkupField is set to two fields (summary & body) in the
abstract Model (Content). Then when running 'syncdb' I get the followijng
error:

_mysql_exceptions.OperationalError: (1060, &quot;Duplicate column name
'_summary_rendered'&quot;)

A wild guess would be to include the Model's class name in the _rendered field.

[shadow] Safe escaped markdown does not handle then ">" symbol properly when not part of a valid tag

_This is a _shadow issue* for Issue 21 on Google Code (from which this project was moved).
Added 2008-10-09T13:17:48.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

<b>What steps will reproduce the problem?</b>
1. > is encoded as <p>></p>
2. <> is encoded as <p>&lt;></p>
3. <b> is encoded as <p>&lt;b&gt;</p>

<b>What is the expected output? What do you see instead?</b>

I would have thought that the &quot;>&quot; symbol would always be converted to &gt;
regardless of the context.  I'm not sure if it's even an illegal syntax,
but it is probably unsafe.

[shadow] cuddled-lists asserts with some input

_This is a _shadow issue* for Issue 36 on Google Code (from which this project was moved).
Added 2010-05-06T14:21:22.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-High.
Please make updates to the bug there.*

Original description

Try to convert the following input with the cuddled-lists extension turned on:

'''
Header:
    * bullet one, indented by four spaces
    * bullet two, indented by four spaces
'''

Traceback (most recent call last):
  File &quot;<stdin>&quot;, line 1, in ?
  File &quot;markdown2.py&quot;, line 272, in convert
    text = self._run_block_gamut(text)
  File &quot;markdown2.py&quot;, line 681, in _run_block_gamut
    text = self._form_paragraphs(text)
  File &quot;markdown2.py&quot;, line 1415, in _form_paragraphs
    assert cuddled_list.startswith(&quot;<ul>&quot;) or cuddled_list.startswith(&quot;<ol>&quot;)
AssertionError

[shadow] innerHTML of backlink of footnotes extra

_This is a _shadow issue* for Issue 37 on Google Code (from which this project was moved).
Added 2010-05-07T10:32:21.000Z by [email protected].
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

I want to suggest an option for footnotes extra, a way to specify the 
backlink's innerHTML (innerText):

    $ markdown2 --extras=footnotes=^ file.mkd

It generates &quot;^&quot; as a backlink instead of &quot;↩&quot; (&#8617;), user can choice 
whatever they want.

The reason to have this option is not all fonts have `&#8617` glyph. Of 
course, we can use CSS to specify another font which have that glyph. But, 
for me, I don't want to have different font even I couldn't tell the 
difference.

The patch has `backlink_innerhtml` variable in `_add_footnotes()`, it's not 
a proper name because this extras splitter:

    splitter = re.compile(&quot;[,;: ]+&quot;)

In HTML, using space is inevitable, you can't give a `<img>` or use a plain 
text &quot;Go Back&quot;.  But I don't think they are really needed.

[shadow] smarty-pants and quotes in between backticks

_This is a _shadow issue* for Issue 48 on Google Code (from which this project was moved).
Added 2010-11-05T05:03:25.000Z by [email protected].
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

smarty-pants shouldn't modify quotations marks or anything in between backticks.

The step to reproduce:

1. echo &quot;\`'abc'\`&quot; > test.mkd
2. python markdown2.py -x smarty-pants test.mkd

The content of test.mkd is

    `'abc'`

The correct output should be

    <p><code>'abc'</code></p>

But I got

    <p><code>&#8217;abc&#8217;</code></p>

I am using r263.

[shadow] how to make markdown latex-friendly?

_This is a _shadow issue* for Issue 45 on Google Code (from which this project was moved).
Added 2010-08-30T22:57:12.000Z by [email protected].
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

Hi I would like to be able to completely escape from markdown processing between $ ... $  and $$ ... $$ to contain latex - to be rendered with MathJax.

So far enabling code-friendly extra helped, but I bet there are cases where markdown will still mangle latex. Is there a solution for that?

Thanks.

[shadow] Nested list replaced with [HTML REMOVED] in safe mode

_This is a _shadow issue* for Issue 9 on Google Code (from which this project was moved).
Added 2007-11-10T21:37:38.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-High.
Please make updates to the bug there.*

Original description

This markdown:

    - test
    - test
        - test
        - test

results in:

    <ul>
    <li>test</li>
    <li>test
    [HTML_REMOVED]
    [HTML_REMOVED]test[HTML_REMOVED]
    [HTML_REMOVED]test[HTML_REMOVED]
    [HTML_REMOVED]</li>
    </ul>

when safe_mode=True. Works fine without safe mode.

[shadow] URLs surrounded with "<" and ">" are killed with safe_mode=True

_This is a _shadow issue* for Issue 7 on Google Code (from which this project was moved).
Added 2007-11-10T10:26:06.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-High.
Please make updates to the bug there.*

Original description

Looks like things like &quot;<http://google.com/>&quot; are treated as HTML and are
replaced with &quot;[HTML REMOVED]&quot; before they get a chance to be treated as links.

[shadow] interesting error when using markdown2 as a postgres plpythonu stored function

_This is a _shadow issue* for Issue 20 on Google Code (from which this project was moved).
Added 2008-09-22T17:46:22.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

First, download and install the markdown2 package.

Next, create a stored procedure for Postgres using:

CREATE OR REPLACE FUNCTION markdown(src text) RETURNS text
    AS $$

import markdown2
return markdown2.markdown(src)

$$
    LANGUAGE plpythonu STRICT;

(it is preferable to put the above into a file, for example test.sql)

Next, install the above function into your database and test using:

db=# \i test.sql
CREATE FUNCTION

db=# SELECT markdown('test');
ERROR:  plpython: function &quot;markdown&quot; failed
DETAIL:  <type 'exceptions.AttributeError'>: 'module' object has no attribute 'argv'
db=# ^D\q

<b>What version of the product are you using? On what operating system?</b>

Python 2.5.1 (r251:54863, Apr 15 2008, 22:57:26) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.

Database is Postgres 8.3.3, compiled from source to work with Apple's pre-installed
version of Python.

Platform is Apple's Leopard 10.5.5 (9F33)

<b>Please provide any additional information below.</b>

Workaround: removing all the mainline stuff in lib/markdown2.py makes the module work.

However, that workaround isn't optimal since the command-line functionality as given
is removed thus impairing module functions, not to mention bad practice.

You must create a plpythonu language wrapper before attempting any of the above
within postgres.  Do that by issuing:

shell% psql db # db is your database
db# CREATE PROCEDURAL LANGUAGE plpythonu;
db# \q
shell%

[shadow] security hole in md5 hashing of HTML blobs

_This is a _shadow issue* for Issue 29 on Google Code (from which this project was moved).
Added 2009-09-28T22:00:18.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-High.
Please make updates to the bug there.*

Original description

markdown2.py has the equivalent of this problem that hit reddit.com
recently (they use a different Python markdown module):

http://blog.reddit.com/2009/09/we-had-some-bugs-and-it-hurt-us.html

Massimo Di Pierro mentioned this and provided a starter patch to fix this
(see attached).

[shadow] Horrible code structure

_This is a _shadow issue* for Issue 34 on Google Code (from which this project was moved).
Added 2010-04-04T13:49:14.000Z by [email protected]. Closed (WontFix).
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

I'm picking a python markdown library to use on a small thing.

I've looked on markdown and markdown2, from what I've read markdown2 is 
supposed to be an improvement over the original python-markdown.

But looking thru the code, markdown2 is horrible. 

Extensions are hardcoded into the markdown parsing code and it's literaly 
impossible to create a new extension without monkeypatching the markdown 
parser.

This is a pretty big defect that will drive almost anyone away from this 
library.

[shadow] idea for new perf suite (and Unicode error case)

_This is a _shadow issue* for Issue 12 on Google Code (from which this project was moved).
Added 2008-01-11T10:46:49.000Z by wojdyr.
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

it could be interesting to use the TextMate manual for benchmarking,
because it's used to compare perl and haskel implementations here: 
http://code.google.com/p/pandoc/wiki/Benchmarks

the text of the manual is not there, I got it by e-mail from John
MacFarlane, so I'm attaching it.

Unfortunately I got UnicodeEncodeError when trying to run a benchmark, but
I guess this will be fixed sooner or later and the manual will be useful
for benchmarking.

[shadow] problems with some list edge cases

_This is a _shadow issue* for Issue 16 on Google Code (from which this project was moved).
Added 2008-02-16T18:00:49.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-High.
Please make updates to the bug there.*

Original description

In the recent &quot;Problem with UL followed by OL&quot; thread on markdown-discuss
an example was brought up that markdown2.py doesn't handle properly.

I've added test/tm-cases/lists2.text for this:

{{{
cd test
./test.py lists2
}}}

[shadow] Javascript injection

_This is a _shadow issue* for Issue 30 on Google Code (from which this project was moved).
Added 2009-09-29T17:29:09.000Z by [email protected]. Closed (Fixed).
Labels: Type-Defect, Priority-Critical.
Please make updates to the bug there.*

Original description

Quotation marks are not filtered from attributes, you can inject javascript
events into elements. Here is an example:

from markdown2 import markdown
test = &quot;&quot;&quot;
![a][b]
[b]: http://static.reddit.com/reddit.com.header.png&quot;
onload=&quot;alert('javascript injected')
&quot;&quot;&quot;
print markdown(test, safe_mode=True)

The result is:
<p><img src=&quot;http://static.reddit.com/reddit.com.header.png&quot;
onload=&quot;alert('javascript injected')&quot; alt=&quot;a&quot; /></p>

Expected result is:
<p><img src=&quot;http://static.reddit.com/reddit.com.header.png&quot;
onload=&quot;alert('javascript injected')&quot; alt=&quot;a&quot; /></p>

[shadow] No mailing list, or Google groups page

_This is a _shadow issue* for Issue 25 on Google Code (from which this project was moved).
Added 2009-05-23T00:45:32.000Z by hannson. Closed (Done).
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

Summary says it all but, no official place to ask questions or to talk with
the community etc..

Possible workarounds:
http://groups.google.com/groups/create?lnk=gcphpp&pli=1

Or a link from the homepage to an URL of the owners choice.

[shadow] SmartyPants patch

_This is a _shadow issue* for Issue 42 on Google Code (from which this project was moved).
Added 2010-06-19T14:43:00.000Z by nikhil.chelliah. Closed (Fixed).
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

Hi Trent,

Any interest in auditing or accepting this SmartyPants patch?  

This addition does not support a couple features that were present in the original:
* No support for the &quot;old-school&quot; dash syntax mentioned in SmartyPants.pl, that is, -- for em dashes and --- for en dashes.
* No support for backtick-delimited quotes.  First, they're ugly and rarely used.  And second, it's too easy to invoke the regex on accident if it is supposed to match with a closing tag, which can interfere with the more important <code> segments.  It's somewhat mitigated by only supported ``'' instead of `', as SmartyPants.pl does, but still...too much ambiguity.

The contractions are generally pretty simple (but sometimes) a little smarter than SmartyPants.pl's).  The code assumes &quot;text&quot; means anything that's not whitespace or the beginning or end of the string.
* If a prime falls between text and whitespace, the quotation mark curls in the direction of the text.
* A single prime falling in between text and text becomes an apostrophe, and curls to the left.
* A single prime falling in front of tis, twas, Tis, or Twas becomes an apostrophe, too.
* Closing quotation marks don't have to fall in front of whitespace; they can also fall in front of common punctuation, as they would in British English.

I also tested some code that substituted guillemets for double angle brackets, but I removed it because of (a) the fact that the engine escapes angle brackets ASAP and (b) extending Markdown/SmartyPants &quot;conventions&quot; without another configuration option may not be the best policy.

I did write an input file for test.py, but I haven't been able to manually generate an HTML file that is correctly formatted - but it's always close.

Thanks, Nikhil

[shadow] Add setuptools and nose support

_This is a _shadow issue* for Issue 14 on Google Code (from which this project was moved).
Added 2008-01-28T16:12:22.000Z by [email protected].
Labels: Type-Task, Priority-Low.
Please make updates to the bug there.*

Original description

The current status of this project not being distutils or setuptools
compatible makes it very unattractive for me, and makes deploying a hassle.
The makefile provided has a lot of useless cruft.

I've attached a patch that adds a basic setup.py. It also removes the test
runner you made, replacing it with nose. There are also some fixes with
regards to how you detect for set() and reversed(), as well as some style
fixes.

I would also recommend you separate out the code into multiple modules.
Just dumping everything into one file is a little silly. I could see you at
least starting by separating out the command line runner and the parser
itself (e.g. markdown2.__init__ and markdown2.parser).

Once all this is done, I'd also add some more classifiers to setup.py and
submit it to PyPI.

[shadow] Extra toc, Table of Contents

_This is a _shadow issue* for Issue 49 on Google Code (from which this project was moved).
Added 2010-11-05T05:25:16.000Z by [email protected].
Labels: Type-Defect, Priority-Medium.
Please make updates to the bug there.*

Original description

I am trying to find more information on the development of extra toc, I am planning to use it. But I really found nothing on issues, author's blog, or group.

I downloaded the 1.0.1.17 and it's not there. So, I checkout r263.

I have to run with `-v` to get the HTML code of toc from debugging message, e.g.

    echo '## Heading' > /tmp/test ; markdown2.py -v -x toc /tmp/test
    <h2 id=&quot;heading&quot;>Heading</h2>
    DEBUG:markdown:toc_html: <ul>
      <li><a href=&quot;#heading&quot;>Heading</a></li>
    </ul>

I think toc is still not ready for stable usage. But I want to know how it would be used. I hope I open the issue can help or the author can clearly tell us.

In normal usage, we wouldn't want to copy the output of debugging message and paste it into the markdown source then generate again. So, there must be some magic code to let markdown2.py to replace with HTML of toc when generating HTML code, perhaps `<!-- TOC -->`?

Another issue I am thinking is, even toc needs a header, for example

    ## Table of Contents
    <!-- TOC -->

How to let markdown2.py know which is header of TOC and don't put it into HTML of toc? Moreover, skipping some deep headers like h5, h6?

(Sorry for opening issue instead of posting on group, but I do think this is a better way to track down since toc seems certainly in future release)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.