Centering text/pictures in HTML with markdown and pandoc
Asked Answered
C

1

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?

Cairngorm answered 8/9, 2016 at 21:2 Comment(1)
For those in the unknown, hakyll produces static web sites using pandoc. Hence, the pandoc output is html. This was originally not specified by the OP in his question.Nest
N
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**

:::
Neutralism answered 10/9, 2016 at 9:5 Comment(3)
Can you explain a little more? Is (must?) the header (be) a separate file from the markdown file? How is it included in the markdown file?Abfarad
"Centering would be styling" -- so is bold, italics, underline, ordered/unordered lists, etc. ...Carlotacarlotta
@theMayer: ‘italics’ might be styling, but ‘emphasize’ is semantic. So are lists.Cardamom

© 2022 - 2024 — McMap. All rights reserved.