Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

use markdown with django

http://www.freewisdom.org/projects/python-markdown/Django

Install markdown and make sure it is in your python path.

http://www.freewisdom.org/projects/python-markdown/Installation

Include 'django.contrib.markup' in INSTALLED_APPS in your settings.py file.

   1  
   2  ..load
   3  {% load markup %}
   4  
   5  ..then use
   6  {{ post.body|markdown }}

Format code with line numbers in Markdown notation

   1  
   2  C:\>type Format.groovy | groovy Format
   3       1: def counter = 1
   4       2:
   5       3: System.in.eachLine {
   6       4:         line ->
   7       5:
   8       6:         def result = "    "
   9       7:         (2 - ("" + counter).length()).times { result += " " }
  10       8:         result += "${counter}: ${line}"
  11       9:         println result
  12      10:         counter++
  13      11: }
  14  
  15  C:\>


   1  
   2  def counter = 1
   3  
   4  System.in.eachLine {
   5  	line ->
   6  	
   7  	def result = "    "
   8  	(2 - ("" + counter).length()).times { result += " " }
   9  	result += "${counter}: ${line}"
  10  	println result
  11  	counter++
  12  }
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS