sohini2689 / gaewiki

Automatically exported from code.google.com/p/gaewiki
0 stars 0 forks source link

Syntax Highlight #25

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I change the default markdown version from 1.7 to the newest 2.0.3, and use the 
extension "Fenced Code Blocks" to make syntax highlight.

This works in the previous gaewiki version, but don't work in the newest 
version today.

The contrast images are below.

handlers.py: line 178
text = markdown(text).strip() --> text = markdown(text, ['fenced_code']).strip()

def wikify(text):
    """
    Covnerts Markdown text into HTML.  Supports interwikis.
    """
    text, count = WIKI_WORD_PATTERN.subn(_wikify_one, text)
    text = markdown.markdown(text, ['fenced_code']).strip()
    return text

Original issue reported on code.google.com by joseph...@gmail.com on 5 Nov 2010 at 7:21

Attachments:

GoogleCodeExporter commented 8 years ago
This issue was updated by revision 9755cf82d6.

- Updated Markdown to 2.0.3.
- Markdown extensions can be enabled in gaewiki:settings with the
  "markdown-extensions" property, see the wiki:
  http://code.google.com/p/gaewiki/wiki/Settings#markdown-extensions

Original comment by justin.forest on 5 Nov 2010 at 10:07

GoogleCodeExporter commented 8 years ago
Are you sure the actual code highlighting was done by the fenced_code itself?  
I've studied the extension code and all it does is adding a <pre> block with a 
class that corresponds to the language.  I think you must have used some 
JavaScript code to highlight the syntax.

Original comment by justin.forest on 5 Nov 2010 at 10:08

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
The last update of my gaewiki was 200 days ago, so I forgot something.

To make syntax highlight, besides feced_code extension, you also need 
highlight.js

http://softwaremaniacs.org/soft/highlight/en/

download highlight.js,copy it to dir static, add follow code to 
templates/view.html

<!-- highlight! -->
  <link rel="stylesheet" title="Default" href="/static/scripts/highlight/styles/default.css">
  <script type="text/javascript" src="/static/highlight.pack.js"></script>
  <script type="text/javascript">
    hljs.initHighlightingOnLoad();
  </script>

Original comment by joseph...@gmail.com on 5 Nov 2010 at 11:25

GoogleCodeExporter commented 8 years ago
Thank you for this information.

I've added some settings to simplify using custom CSS/JS.  You can now enable 
syntax highlighting without any changes to the code, as described in the wiki:

  http://code.google.com/p/gaewiki/wiki/Settings#markdown-extensions

You can see it in action at the demo site:

  http://gaewiki-demo.appspot.com/Welcome

Original comment by justin.forest on 5 Nov 2010 at 11:30