htmlmarkdownpandoc

markdown to html via pandoc full page width


I have a markdown file test.md

---
title: README TCC
numbersections: true
---

# README
sdfsafdasfdijmsldfnmlsnmkldfnmlsnmfdnmsaklm saldnmflasnfjlsanfjlnsajlfnjslnf sadfnasjlfdnlasd sdfsafdasfdijmsldfnmlsnmkldfnmlsnmfdnmsaklm sdfsafdasfdijmsldfnmlsnmkldfnmlsnmfdnmsaklm sdfsafdasfdijmsldfnmlsnmkldfnmlsnmfdnmsaklm sdfsafdasfdijmsldfnmlsnmkldfnmlsnmfdnmsaklm sdfsafdasfdijmsldfnmlsnmkldfnmlsnmfdnmsaklm

which I convert into an html file via pandoc -s --toc ./test.md -o README.html --number-sections

This is the resulting README.html viewed in chrome:

enter image description here

But I want to let the text span the whole page!

Within README.hmtl the style of body is specified as:

body {
  margin: 0 auto;
  max-width: 36em;
  padding-left: 50px;
  padding-right: 50px;
  padding-top: 50px;
  padding-bottom: 50px;
  hyphens: auto;
  word-wrap: break-word;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}

Adding min-width:80%; as an attribute, yields the desired behavior:

enter image description here

How can I make pandoc automatically generate a html that spans the whole page, when generating the document, i.e. include the min-width:80%; property?


Solution

  • Place the below snippet anywhere in your Markdown document:

    ``` {=html}
    <style>
    body { min-width: 80% !important; }
    </style>
    ```
    

    This will override the default min-width setting.