Skip to content

Image size

Giorgio Garofalo edited this page Nov 7, 2024 · 5 revisions

Whereas base Markdown requires HTML code to constrain the size of an image, Quarkdown introduces a new syntax extension to achieve the same result in a more elegant and efficient way:

!(200x150)[Alt](image.png)

<!-- or -->

!(200*150)[Alt](image.png)

<!-- or -->

!(200 150)[Alt](image.png)

The previous (equivalent) examples load image.png with the label Alt as CommonMark Markdown would do, but also adding an additional size constraint, making the visible image fit into a 200px by 150px box.

Apart from pixels, whose unit can be omitted, any other size unit is supported. In this case the x delimiter can no longer be used, in favor of either * or a space.

!(5cm*35mm)[Alt](image.png)

<!-- or -->

!(2.5in 1cm)[Alt](image.png)

In case one of the components (width or height) is equal to _ (underscore), it becomes automatic, meaning that component is automatically calculated in order to keep the original aspect ratio.

Examples:

  • 300x_, 5cm*_, 2in _ (auto height)
  • _x100, _*15mm, _ 2in (auto width)
Clone this wiki locally