from django.utils.safestring import mark_safe
import CommonMark


# Convert a markdown string into HTML5, and prevent Django from escaping it
def mdToHTML(value):
	parser = CommonMark.DocParser()
	renderer = CommonMark.HTMLRenderer()

	ast = parser.parse(value)

	return mark_safe(renderer.render(ast))


# Get a summary of a post
def summarize(fullBody):
	firstNewline = fullBody.find("\n")

	if firstNewline > 0:
		return unicode(fullBody)[:firstNewline]

	return fullBody

from django.utils.safestring import mark_safe
import CommonMark


# Convert a markdown string into HTML5, and prevent Django from escaping it
def mdToHTML(value):
	parser = CommonMark.Parser()
	renderer = CommonMark.HTMLRenderer()

	ast = parser.parse(value)

	return mark_safe(renderer.render(ast))


# Get a summary of a post
def summarize(fullBody):
	firstNewline = fullBody.find("\n")

	if firstNewline > 0:
		return fullBody[:firstNewline]

	return fullBody

Fix changed CommonMark syntax (?)
Fix changed CommonMark syntax (?)

  from django.utils.safestring import mark_safe
  import CommonMark
  
  
  # Convert a markdown string into HTML5, and prevent Django from escaping it
  def mdToHTML(value):
- 	parser = CommonMark.DocParser()
+ 	parser = CommonMark.Parser()
  	renderer = CommonMark.HTMLRenderer()
  
  	ast = parser.parse(value)
  
  	return mark_safe(renderer.render(ast))
  
  
  # Get a summary of a post
  def summarize(fullBody):
  	firstNewline = fullBody.find("\n")
  
  	if firstNewline > 0:
- 		return unicode(fullBody)[:firstNewline]
+ 		return fullBody[:firstNewline]
  
  	return fullBody
  
Fix changed CommonMark syntax (?)
## Code Before:
from django.utils.safestring import mark_safe
import CommonMark


# Convert a markdown string into HTML5, and prevent Django from escaping it
def mdToHTML(value):
	parser = CommonMark.DocParser()
	renderer = CommonMark.HTMLRenderer()

	ast = parser.parse(value)

	return mark_safe(renderer.render(ast))


# Get a summary of a post
def summarize(fullBody):
	firstNewline = fullBody.find("\n")

	if firstNewline > 0:
		return unicode(fullBody)[:firstNewline]

	return fullBody

## Instruction:
Fix changed CommonMark syntax (?)
## Code After:
from django.utils.safestring import mark_safe
import CommonMark


# Convert a markdown string into HTML5, and prevent Django from escaping it
def mdToHTML(value):
	parser = CommonMark.Parser()
	renderer = CommonMark.HTMLRenderer()

	ast = parser.parse(value)

	return mark_safe(renderer.render(ast))


# Get a summary of a post
def summarize(fullBody):
	firstNewline = fullBody.find("\n")

	if firstNewline > 0:
		return fullBody[:firstNewline]

	return fullBody
