8

I am trying to write a post with hakyll in markdown via pandoc.

I successfully added some pictures, tables and code blocks with markdown. However, I would like to center my pictures and some text paragraph.

Is it possible to center text and pictures with pandoc and the markdown markup language?

Serge Stroobandt
  • 28,495
  • 9
  • 107
  • 102
JeanJouX
  • 2,555
  • 1
  • 25
  • 37
  • For those in the unknown, [`hakyll` produces static web sites](https://jaspervdj.be/hakyll/) using `pandoc`. Hence, the `pandoc` output is `html`. This was originally not specified by the OP in his question. – Serge Stroobandt Aug 23 '20 at 10:36

1 Answers1

3

Think of markdown as a nicer syntax for HTML – it's only the content, no styling. (Centering would be styling.) You cannot center text in HTML either. But you can add classes, then style them with CSS (in your Hakyll theme).

Pandoc markdown currently supports attributes on images:

![](img.jpg){.myClass}

but not paragraphs, however you can wrap stuff in divs:

# my markdown header

::: {.myClass}

one paragraph

second paragraph, **strong**

:::
mb21
  • 34,845
  • 8
  • 116
  • 142