Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/markdown-slides.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Markdown from './markdown';

const transformStringsIntoJSX = function (strings) {
return strings
.split('---')
.split(/\n---\n/)
.map((markdown, index) => (
<Slide key={`md-slide-${index}`}>
<Markdown>{ markdown }</Markdown>
Expand Down
50 changes: 33 additions & 17 deletions src/components/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ import Quote from './quote';
import S from './s';
import Text from './text';

import Table from './table';
import TableHeader from './table-header';
import TableRow from './table-row';
import TableHeaderItem from './table-header-item';
import TableBody from './table-body';
import TableItem from './table-item';


const _Heading = size => {
const component = ({ children }) => <Heading size={size}>{children}</Heading>;
component.propTypes = { children: PropTypes.node };
Expand All @@ -32,23 +40,31 @@ const _CombineBlockQuote = ({ children }) => (
_CombineBlockQuote.propTypes = { children: PropTypes.node };

const compile = marksy({
a: Link,
blockquote: _CombineBlockQuote,
code: CodePane,
del: _S('strikethrough'),
em: _S('italic'),
h1: _Heading(1),
h2: _Heading(2),
h3: _Heading(3),
h4: _Heading(4),
h5: _Heading(5),
h6: _Heading(6),
img: Image,
codespan: Code,
li: ListItem,
p: Text,
strong: _S('bold'),
ul: List,
elements: {
a: Link,
blockquote: _CombineBlockQuote,
code: CodePane,
del: _S('strikethrough'),
em: _S('italic'),
h1: _Heading(1),
h2: _Heading(2),
h3: _Heading(3),
h4: _Heading(4),
h5: _Heading(5),
h6: _Heading(6),
img: Image,
codespan: Code,
li: ListItem,
p: Text,
strong: _S('bold'),
ul: List,
table: Table,
thead: TableHeader,
th: TableHeaderItem,
tbody: TableBody,
tr: TableRow,
td: TableItem,
}
});

export default class Markdown extends Component {
Expand Down