Docusaurus使用手册
· 阅读需 2 分钟
高亮显示代码一行或者几行
1、highlight-next-line您可以使用带有highlight-start和的注释highlight-end来选择要突出显示的行。
function HighlightSomeText(highlight) {
if (highlight) {
return '这行被高亮了!';
}
return '这里不会';
}
function HighlightMoreText(highlight) {
if (highlight) {
return '这块被高亮了!';
}
return '这里不会';
}
2、采用元数据标记显示高亮行
import React from 'react';
function MyComponent(props) {
if (props.isBar) {
return <div>Bar</div>;
}
return <div>Foo</div>;
}
export default MyComponent;
展示代码行序号
import React from 'react';
export default function MyComponent(props) {
return <div>Foo</div>;
}
警告
备注
Some content with Markdown syntax
. Check this api
.
提示
Some content with Markdown syntax
. Check this api
.
信息
Some content with Markdown syntax
. Check this api
.
注意
Some content with Markdown syntax
. Check this api
.
危险
Some content with Markdown syntax
. Check this api
.
Parent
Parent content
Child
Child content
Deep Child
Deep child content