Skip to content

Commit

Permalink
Use a newer markdown parser/renderer. Fixes #316
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Mathews committed Sep 9, 2015
1 parent 018814f commit 17fd98c
Show file tree
Hide file tree
Showing 7 changed files with 2,872 additions and 2,852 deletions.
5 changes: 2 additions & 3 deletions app/assets/javascripts/components/common/text_area_input.cjsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
React = require 'react'
Marked = require 'marked'
MarkedRenderer = require '../../utils/marked_renderer'
md = require('markdown-it')({ html: true, linkify: true })
InputMixin = require '../../mixins/input_mixin'

TextAreaInput = React.createClass(
Expand Down Expand Up @@ -48,7 +47,7 @@ TextAreaInput = React.createClass(
{input_element}
</label>
else if @props.value
raw_html = Marked(@props.value, { renderer: MarkedRenderer })
raw_html = md.render(@props.value)
<div dangerouslySetInnerHTML={{__html: raw_html}}></div>
else
<p className="content"></p>
Expand Down
5 changes: 2 additions & 3 deletions app/assets/javascripts/components/overview/milestones.cjsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ React = require 'react'
BlockStore = require '../../stores/block_store'
WeekStore = require '../../stores/week_store'
CourseStore = require '../../stores/course_store'
Marked = require 'marked'
MarkedRenderer = require '../../utils/marked_renderer'
md = require('markdown-it')({ html: true, linkify: true })

getState = ->
weeks: WeekStore.getWeeks()
Expand All @@ -26,7 +25,7 @@ Milestones = React.createClass(
milestone_blocks.map (block) =>
classNames = 'module__data'
classNames += ' completed' if @weekIsCompleted(week)
raw_html = Marked(block.content, { renderer: MarkedRenderer })
raw_html = md.render(block.content)
@blocks.push(
<div key={block.id} className='section-header'>
<div className={classNames}>
Expand Down
7 changes: 3 additions & 4 deletions app/assets/javascripts/components/wizard/option.cjsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
React = require 'react/addons'
Marked = require 'marked'
MarkedRenderer = require '../../utils/marked_renderer'
md = require('markdown-it')({ html: true, linkify: true })
WizardActions = require '../../actions/wizard_actions'

Option = React.createClass(
Expand All @@ -26,15 +25,15 @@ Option = React.createClass(
more_className += ' open'
expand = (
<div className={expand_className} ref='expandable'>
<div dangerouslySetInnerHTML={{__html: Marked(@props.option.description, { renderer: MarkedRenderer })}}></div>
<div dangerouslySetInnerHTML={{__html: md.render(@props.option.description)}}></div>
</div>
)
expand_link = (
<button className={more_className} onClick={@expand}><p>{expand_text}</p></button>
)
if @props.option.blurb?
blurb = (
<div dangerouslySetInnerHTML={{__html: Marked(@props.option.blurb, { renderer: MarkedRenderer })}}></div>
<div dangerouslySetInnerHTML={{__html: md.render(@props.option.blurb)}}></div>
)
if disabled
notice = <h3>{I18n.t('wizard.min_weeks', {
Expand Down
5 changes: 2 additions & 3 deletions app/assets/javascripts/components/wizard/panel.cjsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
React = require 'react/addons'
Marked = require 'marked'
MarkedRenderer = require '../../utils/marked_renderer'
md = require('markdown-it')({ html: true, linkify: true })
WizardActions = require '../../actions/wizard_actions'
WizardStore = require '../../stores/wizard_store'

Expand Down Expand Up @@ -75,7 +74,7 @@ Panel = React.createClass(
</div>
</div>
<h3>{@props.panel.title}</h3>
<div dangerouslySetInnerHTML={{__html: Marked(@props.panel.description, { renderer: MarkedRenderer })}}></div>
<div dangerouslySetInnerHTML={{__html: md.render(@props.panel.description)}}></div>
<div className='wizard__panel__options'>{options}</div>
<div className='wizard__panel__controls'>
<div className='left'>
Expand Down
10 changes: 0 additions & 10 deletions app/assets/javascripts/utils/marked_renderer.coffee

This file was deleted.

Loading

0 comments on commit 17fd98c

Please sign in to comment.