markdown是否支持本机文本对齐而不使用html + css?


当前回答

对于Markdown Extra,您可以使用自定义属性:

# Example text {style=text-align:center}

这适用于标题和块引号,但不适用于段落、内联元素和代码块。

更短的版本(但在HTML 5中不支持):

# Example text {align=center}

其他回答

div元素有自己的对齐属性align。

<div align="center">
  my text here.
</div>

居中对齐,将你想居中对齐的文本用箭头(-> <-)环绕起来,就像这样:

-> This is center aligned <-

我发现在jupyter笔记本单元格上使用latex语法非常有用,比如:

![good-boy](https://i.imgur.com/xtoLyW2.jpg  "Good boy on boat")

$$\text{This is some centered text}$$

原生markdown不支持没有HTML + css的文本对齐。

这有点俗气,但如果你正在使用GFM或其他支持用管道构建表的MD语法,你可以使用列对齐特性:

|| <!-- empty table header -->
|:--:| <!-- table header/body separator with center formatting -->
| I'm centered! | <!-- cell gets column's alignment -->

这在标记中起作用。