Skip to content

Commit 977be9a

Browse files
Move showdown import to Answer/View
1 parent 948ca0c commit 977be9a

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/Global/Render.fs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,3 @@ let pageNotFound =
1111
[ Container.container [ Container.Modifiers [ Modifier.TextAlignment(Screen.All, TextAlignment.Centered) ] ]
1212
[ Heading.h1 [ ]
1313
[ str "404" ] ] ] ]
14-
15-
let converter = Showdown.Globals.Converter.Create()
16-
17-
type DangerousInnerHtml =
18-
{ __html : string }
19-
20-
let contentFromMarkdown options str =
21-
Content.content
22-
[ yield! options
23-
yield Content.Props [ DangerouslySetInnerHTML { __html = converter.makeHtml str } ] ]
24-
[ ]

src/Question/Show/Answer/View.fs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ open Fable.FontAwesome
88
open Fable.FontAwesome.Free
99
open System
1010

11+
let converter = Showdown.Globals.Converter.Create()
12+
13+
type DangerousInnerHtml =
14+
{ __html : string }
15+
16+
let contentFromMarkdown options str =
17+
Content.content
18+
[ yield! options
19+
yield Content.Props [ DangerouslySetInnerHTML { __html = converter.makeHtml str } ] ]
20+
[ ]
21+
1122
let private voteArea score =
1223
let icon =
1324
if score > 0 then
@@ -29,7 +40,7 @@ let root model dispatch =
2940
[ Image.image [ Image.Is64x64 ]
3041
[ img [ Src ("avatars/" + model.Author.Avatar) ] ] ]
3142
Media.content [ ]
32-
[ Render.contentFromMarkdown [ ] model.Answer.Content
43+
[ contentFromMarkdown [ ] model.Answer.Content
3344
Level.level [ ]
3445
[ Level.right [ CustomClass "vote-area" ]
3546
[ Button.button [ Button.IsLoading model.IsLoading

src/Question/Show/View.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ let private questionsView (question : QuestionInfo) answers dispatch =
5555
[ Image.image [ Image.Is64x64 ]
5656
[ img [ Src ("avatars/" + question.Author.Avatar) ] ] ]
5757
Media.content [ ]
58-
[ yield Render.contentFromMarkdown [ ]
58+
[ yield Answer.View.contentFromMarkdown [ ]
5959
question.Description
6060
yield Level.level [ ]
6161
[ Level.left [ ] [ ] // Needed to force the level right aligment

0 commit comments

Comments
 (0)