Markdown 在Docusaurus中将超链接或图像居中
我正在建立一个网站 我有一个文件链接:Markdown 在Docusaurus中将超链接或图像居中,markdown,docusaurus,Markdown,Docusaurus,我正在建立一个网站 我有一个文件链接: [10Studio-Sample-EN.xlsx](https://www.10studio.tech/files/10Studio-Sample-EN.xlsx) 现在,我想把这个链接放在中间(传统上使用text-align:center) 我尝试了以下代码: export const Center = ({children}) => ( <div style={{ "textAlign": "cente
[10Studio-Sample-EN.xlsx](https://www.10studio.tech/files/10Studio-Sample-EN.xlsx)
现在,我想把这个链接放在中间(传统上使用text-align:center
)
我尝试了以下代码:
export const Center = ({children}) => (
<div
style={{
"textAlign": "center"
}}>
{children}
</div>
)
<Center>hahahaha</Center>
<Center>[10Studio-Sample-EN.xlsx](https://www.10studio.tech/files/10Studio-Sample-EN.xlsx)</Center>
export const Center=({children})=>(
{儿童}
)
哈哈哈
[10Studio示例EN.xlsx](https://www.10studio.tech/files/10Studio-Sample-EN.xlsx)
它返回了以下消息:
有人知道将超链接(或图像)居中的最简单方法是什么吗?最简单的方法是避免使用标记。我将概述各种方法: 1.使用简单的HTML和CSS 这是最基本的解决方案,绝对有效
<div style={{textAlign: 'center'}}>
<img src="..." />
</div>
2.使用内隐类
Docusaurus classic模板附带Infima,它有一个有用的类来集中内容。这与方法#1类似,但需要提供Infima样式
<div class="text--center">
<img src="..." />
</div>
3.使用带有标记的纯HTML
您似乎对图像使用了不正确的语法,并且使用了链接语法。在[]前面需要一个感叹号
还要注意图像标记语法前后的空行。当我们使用MDX时,在块块块周围放置空行将允许MDX引擎将它们解析为标记,而不是将其视为HTML
<div style={{textAlign: 'center'}}>
![image](/path/to/image.jpg)
</div>
![图像](/path/to/image.jpg)