[markdown] Markdown `native` text alignment

Does markdown support native text-alignment without usage html + css?

This question is related to markdown

The answer is


native markdown doesn't support text alignment without html + css.


To center align, surround the text you wish to center align with arrows (-> <-) like so:

-> This is center aligned <-

It's hacky but if you're using GFM or some other MD syntax which supports building tables with pipes you can use the column alignment features:

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

This works in marked.


In Github You need to write:

<p align="justify">
  Lorem ipsum
</p>

I known this isn't markdown, but <p align="center"> worked for me, so if anyone figures out the markdown syntax instead I'll be happy to use that. Until then I'll use the HTML tag.


I found pretty useful to use latex syntax on jupyter notebooks cells, like:

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

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

The div element has its own alignment attribute, align.

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

For python markdown with attr_list extension the syntax is a little different:

{: #someid .someclass somekey='some value' }

Example:

[Click here](http://exmaple.com){: .btn .btn-primary }

Lead information paragraph
{: .lead }

For Markdown Extra you can use custom attributes:

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

This works for headers and blockquotes, but not for paragraphs, inline elements and code blocks.

A shorter version (but not supported in HTML 5):

# Example text {align=center}

In order to center text in md files you can use the center tag like html tag:

<center>Centered text</center>

I was trying to center an image and none of the techniques suggested in answers here worked. A regular HTML <img> with inline CSS worked for me...

<img style="display: block; margin: auto;" alt="photo" src="{{ site.baseurl }}/images/image.jpg">

This is for a Jekyll blog hosted on GitHub