Skip to content

Commit 8a4cebf

Browse files
antoinegrantkenwheeler
authored andcommitted
Correctly pass the options to marksy (#335)
* Correctly pass the options to marksy * Added support for tables * Be more preecise on the markdown slide split characters
1 parent 8509cf9 commit 8a4cebf

File tree

2 files changed

+34
-18
lines changed

2 files changed

+34
-18
lines changed

src/components/markdown-slides.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Markdown from './markdown';
44

55
const transformStringsIntoJSX = function (strings) {
66
return strings
7-
.split('---')
7+
.split(/\n---\n/)
88
.map((markdown, index) => (
99
<Slide key={`md-slide-${index}`}>
1010
<Markdown>{ markdown }</Markdown>

src/components/markdown.js

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ import Quote from './quote';
1414
import S from './s';
1515
import Text from './text';
1616

17+
import Table from './table';
18+
import TableHeader from './table-header';
19+
import TableRow from './table-row';
20+
import TableHeaderItem from './table-header-item';
21+
import TableBody from './table-body';
22+
import TableItem from './table-item';
23+
24+
1725
const _Heading = size => {
1826
const component = ({ children }) => <Heading size={size}>{children}</Heading>;
1927
component.propTypes = { children: PropTypes.node };
@@ -32,23 +40,31 @@ const _CombineBlockQuote = ({ children }) => (
3240
_CombineBlockQuote.propTypes = { children: PropTypes.node };
3341

3442
const compile = marksy({
35-
a: Link,
36-
blockquote: _CombineBlockQuote,
37-
code: CodePane,
38-
del: _S('strikethrough'),
39-
em: _S('italic'),
40-
h1: _Heading(1),
41-
h2: _Heading(2),
42-
h3: _Heading(3),
43-
h4: _Heading(4),
44-
h5: _Heading(5),
45-
h6: _Heading(6),
46-
img: Image,
47-
codespan: Code,
48-
li: ListItem,
49-
p: Text,
50-
strong: _S('bold'),
51-
ul: List,
43+
elements: {
44+
a: Link,
45+
blockquote: _CombineBlockQuote,
46+
code: CodePane,
47+
del: _S('strikethrough'),
48+
em: _S('italic'),
49+
h1: _Heading(1),
50+
h2: _Heading(2),
51+
h3: _Heading(3),
52+
h4: _Heading(4),
53+
h5: _Heading(5),
54+
h6: _Heading(6),
55+
img: Image,
56+
codespan: Code,
57+
li: ListItem,
58+
p: Text,
59+
strong: _S('bold'),
60+
ul: List,
61+
table: Table,
62+
thead: TableHeader,
63+
th: TableHeaderItem,
64+
tbody: TableBody,
65+
tr: TableRow,
66+
td: TableItem,
67+
}
5268
});
5369

5470
export default class Markdown extends Component {

0 commit comments

Comments
 (0)