Skip to content

Commit 0711473

Browse files
committed
issue #2999 - Support markdown for various texts in Form components
1 parent 829ea1b commit 0711473

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

src/projects/detail/components/SpecQuestionList/SpecQuestionList.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import cn from 'classnames'
44
import _ from 'lodash'
55

66
import HelpModal from '../../../create/components/HelpModal'
7+
import { markdownToHTML } from '../../../../helpers/markdownToState'
78

89
import './SpecQuestionList.scss'
910

@@ -63,9 +64,9 @@ const SpecQuestionListItem = ({
6364
{!!titleAside && <div className="spec-section-title-aside">{titleAside}</div>}
6465
{ help && (<HelpModal {...help} />) }
6566
</h5>}
66-
{!!introduction && <p className="introduction">{introduction}</p>}
67+
{!!introduction && <div className="introduction markdown" dangerouslySetInnerHTML={{__html: markdownToHTML(introduction)}} />}
6768
{children && <div className="child-component">{children}</div>}
68-
{!hideDescription && <p className={cn({bigger: !icon})}>{description}</p>}
69+
{!hideDescription && description && <div className={cn('description', 'markdown', {bigger: !icon})} dangerouslySetInnerHTML={{__html: markdownToHTML(description)}} />}
6970
{shouldShowRequire && (<div className="require-desc">{required ? 'Required' : 'Optional'}</div>) }
7071
</div>
7172
</div>

src/projects/detail/components/SpecQuestionList/SpecQuestionList.scss

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@
105105
}
106106
}
107107

108-
> p,
109108
.description {
110109
@include roboto-light;
111110
font-size: 12px;
@@ -133,8 +132,29 @@
133132
margin-top: $base-unit;
134133
}
135134

136-
.description {
137-
margin-bottom: $base-unit * 4;
135+
.markdown {
136+
ol {
137+
list-style: outside decimal;
138+
padding-left: 5 * $base-unit;
139+
}
140+
141+
ul {
142+
list-style: outside disc;
143+
padding-left: 5 * $base-unit;
144+
}
145+
146+
strong {
147+
font-weight: bold;
148+
}
149+
150+
code {
151+
background: $tc-gray-neutral-light;
152+
color: $tc-gray-100;
153+
font-family: 'Courier New', Courier, monospace;
154+
font-style: normal;
155+
border-radius: 3px;
156+
padding: .2em .4em;
157+
}
138158
}
139159

140160
.child-component {

0 commit comments

Comments
 (0)