File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed
containers/New/TutorialList Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -10,22 +10,49 @@ import './prism'
1010// markdown highlighter instance
1111const md : MarkdownIt = new MarkdownIt ( {
1212 breaks : true ,
13- // highlight: syntaxHighlight,
1413 html : true ,
1514 linkify : true ,
1615} )
1716 // add emoji: https://github.com/markdown-it/markdown-it-emoji
1817 . use ( markdownEmoji )
18+ // add syntax highlighting through prism
1919 . use ( prism , {
2020 defaultLanguage : 'js' ,
2121 } )
2222
23+ // const mdFeatures = [
24+ // 'table',
25+ // 'code',
26+ // 'fence',
27+ // 'blockquote',
28+ // 'hr',
29+ // 'list',
30+ // 'reference',
31+ // 'heading',
32+ // 'lheading',
33+ // 'html_block',
34+ // 'paragraph',
35+ // 'html_inline',
36+ // 'autolink',
37+ // 'link',
38+ // 'image',
39+ // ]
40+
41+ // TODO: markdownIt with rules disabling most features
42+ // const minimalMarkdownIt = new MarkdownIt({
43+ // breaks: false,
44+ // html: true,
45+ // linkify: false,
46+ // }).disable(mdFeatures)
47+
2348interface Props {
2449 children : string
50+ minimal ?: boolean
2551}
2652
2753const Markdown = ( props : Props ) => {
2854 let html : string
55+ // TODO: set md to minimal rule set if specified
2956 try {
3057 html = md . render ( props . children )
3158 } catch ( error ) {
Original file line number Diff line number Diff line change 11import * as React from 'react'
22import { css , jsx } from '@emotion/core'
33import Card from '../../../components/Card'
4+ import Markdown from '../../../components/Markdown'
45
56const styles = {
67 card : {
@@ -39,7 +40,7 @@ const LanguageIcon = () => (
3940const TutorialItem = ( props : Props ) => (
4041 < Card onClick = { props . onSelect } css = { styles . card } >
4142 < h3 > { props . title || 'Title' } </ h3 >
42- < p > { props . description || 'Description' } </ p >
43+ < Markdown minimal > { props . description || 'Description' } </ Markdown >
4344 < div css = { styles . languages } >
4445 < LanguageIcon />
4546 </ div >
You can’t perform that action at this time.
0 commit comments