Permalink
Browse files

Merge branch 'bugfix/markdown' of https://github.com/mAAdhaTTah/spect…

…acle into mAAdhaTTah-bugfix/markdown
  • Loading branch information...
kenwheeler committed Jan 2, 2018
2 parents dbfab81 + f7203d8 commit 3c9ad99f3de944b1d72371c81532c5c2cf24d584
View
@@ -203,6 +203,7 @@ export default class Presentation extends React.Component {
* Lists too!
* With ~~strikethrough~~ and _italic_
* And let's not forget **bold**
* Add some \`inline code\` to your sldes!
`}
</Markdown>
</Slide>
@@ -214,6 +215,12 @@ All the same tags and elements supported in <Markdown /> are supported in Markdo
Slides are separated with **three dashes** and can be used _anywhere_ in the deck. The markdown can either be:
* A Tagged Template Literal
* Imported Markdown from another file
---
Add some inline code to your markdown!
\`\`\`js
const myCode = (is, great) => 'for' + 'sharing';
\`\`\`
`
}
<Slide transition={['slide', 'spin']} bgColor="primary">
View
@@ -27,7 +27,7 @@
"emotion": "^8.0.8",
"history": "^4.6.1",
"lodash": "^4.17.4",
"marksy": "^5.0.0",
"marksy": "^6.0.0",
"normalize.css": "^7.0.0",
"prismjs": "^1.6.0",
"react-emotion": "^8.0.8",
@@ -0,0 +1,26 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Markdown> should render correctly when using inline code 1`] = `
<Styled(div)
styles={
Array [
Object {},
Object {},
]
}
>
<Text
context={Object {}}
key="1"
lineHeight={1}
>
This should
<Code
context={Object {}}
key="0"
>
work
</Code>
</Text>
</Styled(div)>
`;
View
@@ -12,7 +12,7 @@ const StyledCode = styled.code(props => props.styles);
export default class Code extends Component {
createMarkup() {
return {
__html: format(this.props.children)
__html: Array.isArray(this.props.children) ? this.props.children.map(format) : format(this.props.children)
};
}
render() {
@@ -43,12 +43,15 @@ const _CombineBlockQuote = ({ children }) => (
);
_CombineBlockQuote.propTypes = { children: PropTypes.node };
const _CodePane = ({ language, code }) => <CodePane lang={language} source={code}/>;
_CodePane.propTypes = { source: PropTypes.string, lang: PropTypes.string };
const compile = marksy({
createElement,
elements: {
a: Link,
blockquote: _CombineBlockQuote,
code: CodePane,
code: _CodePane,
del: _S('strikethrough'),
em: _S('italic'),
h1: _Heading(1),
@@ -0,0 +1,13 @@
import Markdown from './markdown';
import React from 'react';
import { shallow } from 'enzyme';
describe('<Markdown>', () => {
test('should render correctly when using inline code', () => {
const wrapper = shallow(
<Markdown>This should `work`</Markdown>
);
expect(wrapper).toMatchSnapshot();
});
});
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 3c9ad99

Please sign in to comment.