简体   繁体   中英

Why isn't my CSS formatting showing up in Pandoc HTML documents?

I'm writing notes in Markdown which I want to convert to HTML using Pandoc, so that they're prettier when I look back over them. I am aware that CSS styling can be applied to documents converted with Pandoc by using the -c option, like so:

pandoc "ExamPrep.md" -c style.css -o "ExamPrep.html"

But this just doesn't seem to be working for me. For example, style.css includes the styling in this SO answer to add borders to tables, but my tables in the outputted HTML have no borders.

As noted by this comment on a gist with CSS for lovely Pandoc HTML styling, the --standalone flag has to be included for CSS styling to work, ie,

pandoc --standalone "ExamPrep.md" -c style.css -o "ExamPrep.html"

The Pandoc documentation for --standalone says that it:

Produce[s] output with an appropriate header and footer (eg a standalone HTML, LaTeX, TEI, or RTF file, not a fragment).

Without it, the resulting HTML has no header, and hence, no way of referencing the CSS file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM