javascript
是最受欢迎的编程语音之一,他的变量声明语法类似这样,注意const
赋值是不可修改的。
var a = 1;
let b = 2;
const c = 3;
console.log(a + b + c);
如果代码块语音prism不识别:
这是无语言标记的markdown
源代码为:
| 姓名 | 年龄 | 性别 |
| ---- | ---- | ---- |
| 张三 | 18 | 男 |
输出效果如下:
姓名 | 年龄 | 性别 |
---|---|---|
张三 | 18 | 男 |
源码为
<div style={{background: 'red', color: 'white', fontSize: '2rem'}}>你好</div>
输出效果如下:
<div style={{background: 'red', color: 'white', fontSize: '2rem'}}>你好</div>
从antd
中引入了常用的Card
、Tooltip
、Button
、DirectoryTree
组件,以及自己写的Tabs/Item
组件可以直接在mdx
文件中使用,直接嵌入代码和效果如下
<div className="flex">
<Card style={{ width: 300, border: '1px solid' }}>
<Tooltip title="prompt text">
<Button type={'primary'}>ant design</Button>
</Tooltip>
</Card>
<Card style={{ width: 300 }}>
<DirectoryTree
multiple
defaultExpandAll
treeData={[
{title: 'parent 0', children: [{ title: 'leaf 0-0', isLeaf: true},{ title: 'leaf 0-1', isLeaf: true}]},
{title: 'parent 1', children: [{ title: 'leaf 1-0', isLeaf: true},{ title: 'leaf 1-1', isLeaf: true}]},
]}
/>
</Card>
<Card style={{ width: 300 }}>
<Tabs defaultIndex={0}>
<Item title={"tab1"}>Content of tab1</Item>
<Item title={"tab2"}>Hello Mdx</Item>
</Tabs>
</Card>
</div>
<div className="flex"> <Card style={{ width: 300, border: '1px solid' }}> <Tooltip title="prompt text"> <Button type={'primary'}>ant design</Button> </Tooltip> </Card> <Card style={{ width: 300 }}> <DirectoryTree multiple defaultExpandAll treeData={[ {title: 'parent 0', children: [{ title: 'leaf 0-0', isLeaf: true},{ title: 'leaf 0-1', isLeaf: true}]}, {title: 'parent 1', children: [{ title: 'leaf 1-0', isLeaf: true},{ title: 'leaf 1-1', isLeaf: true}]}, ]} /> </Card> <Card style={{ width: 300 }}> <Tabs defaultIndex={0}> <Item title={"tab1"}>Content of tab1</Item> <Item title={"tab2"}>Hello Mdx</Item> </Tabs> </Card> </div>
CodeSandBox
<iframe src="https://codesandbox.io/embed/6fsg97?view=editor+%2B+preview&module=%2Fsrc%2Findex.js" style={ {width:'100%', height:'500px', border:0, borderRadius: '4px', verflow:'hidden'} } title="react-playgroud" allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking" sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
</iframe>
Jsrun
<iframe width="100%" height="300" src="//jsrun.net/3pDKp/embedded/quick/light" allowFullScreen="allowfullscreen" frameBorder="0"></iframe>