austgl / python-markdown2

Automatically exported from code.google.com/p/python-markdown2
Other
0 stars 0 forks source link

patch from Adam Gomaa to add syntax highlighting and footnote support #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Adam Gomaa sent me this patch (see my email). Look into adding it (by
default off, with options to turn this syntax on)... if possible. I haven't
looked at the patch yet. 

Original issue reported on code.google.com by tre...@gmail.com on 27 Sep 2007 at 4:52

Attachments:

GoogleCodeExporter commented 9 years ago
There was a bug in my code; I didn't notice that it double-escaped the output 
when
doing syntax highlighting. This is the updated patch which fixes that; it only
escapes the code if it doesn't go through Pygments.

Original comment by akgo...@gmail.com on 27 Sep 2007 at 5:54

Attachments:

GoogleCodeExporter commented 9 years ago
revision 54 adds footnotes support. Adam, I've changed what you've given me a 
little
bit. I hope the format of the generated HTML doesn't cause problems for your 
usage. I
*do* intend to provide an easy way to tweak that output with subclassing 
(easier that
overriding the _add_footnotes() method, at least.

Original comment by tre...@gmail.com on 18 Oct 2007 at 6:18

GoogleCodeExporter commented 9 years ago
The pygments-based syntax highlighting is in. However, I'm not sure I love the
Markdown syntax to indicate the language. I plan to bring it up on the
markdown-discuss list for discussion.

Original comment by tre...@gmail.com on 8 Nov 2007 at 2:16

GoogleCodeExporter commented 9 years ago
A nicer way to determine the language might be having the first line of the 
codeblock contain a comment, in 
the language the codeblock represents, with nothing but the name in it.

for example:

<!-- HTML -->
# Python
REM BASIC

You could maybe add a few funny characters inside the comment just to make sure 
there are no accidents. 
This would make the markdown source actually readable in plain text form, 
without worrying about readers 
accidentally thinking :::python is part of the code.

Original comment by its.fl...@gmail.com on 13 Feb 2008 at 8:18

GoogleCodeExporter commented 9 years ago
Not bad.

For comparison Google Code's wiki syntax for code markup is this:

  {{{
  code here
  }}}

and you can indicate the language like this (I believe):

  {{{{Python}
  print "hi"
  }}}

That works fairly naturally. 

For the markup that doesn't identify a language I think it is doing *some* kind 
of
guessing. I don't know how that works, tho.

Anyway, just for comparison.

Original comment by tre...@gmail.com on 13 Feb 2008 at 4:32

GoogleCodeExporter commented 9 years ago
Is it actually guessing in python-markdown2? From the docs, it looks like you 
might have to do the guessing 
yourself using guess_lexer:

http://pygments.org/docs/quickstart/#guessing-lexers

Original comment by its.fl...@gmail.com on 21 Feb 2008 at 10:01