Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc60678e

Browse files
committed
tutorial summary in markdown
1 parent35cd00f commitc60678e

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

‎web-app/src/components/Markdown/index.tsx

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,49 @@ import './prism'
1010
// markdown highlighter instance
1111
constmd:MarkdownIt=newMarkdownIt({
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+
2348
interfaceProps{
2449
children:string
50+
minimal?:boolean
2551
}
2652

2753
constMarkdown=(props:Props)=>{
2854
lethtml:string
55+
// TODO: set md to minimal rule set if specified
2956
try{
3057
html=md.render(props.children)
3158
}catch(error){

‎web-app/src/containers/New/TutorialList/TutorialItem.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import*asReactfrom'react'
22
import{css,jsx}from'@emotion/core'
33
importCardfrom'../../../components/Card'
4+
importMarkdownfrom'../../../components/Markdown'
45

56
conststyles={
67
card:{
@@ -39,7 +40,7 @@ const LanguageIcon = () => (
3940
constTutorialItem=(props:Props)=>(
4041
<CardonClick={props.onSelect}css={styles.card}>
4142
<h3>{props.title||'Title'}</h3>
42-
<p>{props.description||'Description'}</p>
43+
<Markdownminimal>{props.description||'Description'}</Markdown>
4344
<divcss={styles.languages}>
4445
<LanguageIcon/>
4546
</div>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp