Skip to content

Commit

Permalink
feat: add markdown support for description
Browse files Browse the repository at this point in the history
  • Loading branch information
believer committed Aug 23, 2019
1 parent 5fa7c26 commit de671c7
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 6 deletions.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@
"dependencies": {
"bs-css": "9.0.1",
"js-cookie": "2.2.1",
"marked": "^0.7.0",
"re-classnames": "4.0.0",
"react": "16.9.0",
"react-dom": "16.9.0",
"reason-react": "0.7.0"
},
"devDependencies": {
"@semantic-release/changelog": "^3.0.4",
"@semantic-release/changelog": "3.0.4",
"@semantic-release/commit-analyzer": "6.3.0",
"@semantic-release/git": "^7.0.16",
"@semantic-release/git": "7.0.16",
"@semantic-release/release-notes-generator": "7.3.0",
"autoprefixer": "9.6.1",
"bs-platform": "5.0.6",
Expand Down
7 changes: 4 additions & 3 deletions src/App.re
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,10 @@ let make = () => {
}}
{switch (wod.description) {
| Some(desc) =>
<div className="mt-4 text-xs text-gray-500">
{React.string(desc)}
</div>
<div
className="mt-4 text-xs text-gray-500"
dangerouslySetInnerHTML={"__html": Markdown.make(desc)}
/>
| None => React.null
}}
</div>
Expand Down
8 changes: 8 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,11 @@ html,
body {
@apply font-normal m-0 p-0 text-gray-900 bg-gray-100;
}

p {
@apply mb-2;
}

p:last-of-type {
@apply mb-0;
}
6 changes: 5 additions & 1 deletion src/models/Wod.re
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,11 @@ let wods = [
category: Some(`Hero),
description:
Some(
"Wear a weighted west if available. On the last round, do 15 air squats. This Firefighter Hero WOD is dedicated to Keithroy Maynard, FDNY, Engine 33, who was killed on September 11, 2001.",
{j|
Wear a weighted west if available. On the last round, do 15 air squats.
This Firefighter Hero WOD is dedicated to Keithroy Maynard, FDNY, Engine 33, who was killed on September 11, 2001.
|j},
),
timeCap: None,
rounds: Some(5),
Expand Down
1 change: 1 addition & 0 deletions src/utils/Markdown.re
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[@bs.module] external make: string => string = "marked";

0 comments on commit de671c7

Please sign in to comment.