Skip to content

Instantly share code, notes, and snippets.

@maciakl
Created June 14, 2016 13:29
Show Gist options
  • Save maciakl/d954a6325a38afd26a646e1884097e14 to your computer and use it in GitHub Desktop.
Save maciakl/d954a6325a38afd26a646e1884097e14 to your computer and use it in GitHub Desktop.
Pandoc, continous compilation setup.
____ _
| _ \ ___ __ _ __| |_ __ ___ ___
| |_) / _ \/ _` |/ _` | '_ ` _ \ / _ \
| _ < __/ (_| | (_| | | | | | | __/
|_| \_\___|\__,_|\__,_|_| |_| |_|\___|
Pandoc Continuous Compilation Mode
Simple continuous compilation mode with Pandoc.
====================
Project Organization
====================
1. Use Markdown for formatting
2. Put individual "chapters" or sections in separate .md files
3. Start each file with a heading
5. List the files to be compiled in COMPILELIST.TXT
6. Add styling in style.css
The files will be concatenated and compiled in the order they are listed.
To link to a section use an internal anchor link. Use lowercase only and replace
spaces with underscores. Eg:
Heading: ## Introductory Chapter
Link: [link text](#introductory-chapter)
=========
Compiling
=========
To compile once, run:
make
To monitor files, and re-compile when they are changed run:
watch -n1 make
# Run watch -n1 make
files := $(shell xargs -a COMPILELIST.TXT)
index.html: $(files)
pandoc $(files) --toc -f markdown -t html -c style.css -o $@
body {
font-family: "Avenir Next", Helvetica, Arial, sans-serif;
padding:1em;
margin:auto;
max-width:42em;
background:#fefefe;
}
h1, h2, h3, h4, h5, h6 {
font-weight: bold;
}
h1 {
color: #000000;
font-size: 28pt;
}
h2 {
border-bottom: 1px solid #CCCCCC;
color: #000000;
font-size: 24px;
}
h3 {
font-size: 18px;
border-bottom: 1px solid #CCCCCC;
}
h4, h5, h6 {
text-decoration: underline;
}
h4 {
font-size: 16px;
}
h5 {
font-size: 14px;
}
h6 {
color: #777777;
background-color: inherit;
font-size: 14px;
}
hr {
height: 0.2em;
border: 0;
color: #CCCCCC;
background-color: #CCCCCC;
}
p, blockquote, ul, ol, dl, li, table, pre {
margin: 15px 0;
}
a, a:visited {
color: #4183C4;
background-color: inherit;
text-decoration: none;
}
#message {
border-radius: 6px;
border: 1px solid #ccc;
display:block;
width:100%;
height:60px;
margin:6px 0px;
}
button, #ws {
font-size: 10pt;
padding: 4px 6px;
border-radius: 5px;
border: 1px solid #bbb;
background-color: #eee;
}
code, pre, #ws, #message {
font-family: Monaco;
font-size: 10pt;
border-radius: 3px;
background-color: #F8F8F8;
color: inherit;
}
code {
border: 1px solid #EAEAEA;
margin: 0 2px;
padding: 0 5px;
}
pre {
border: 1px solid #CCCCCC;
overflow: auto;
padding: 4px 8px;
}
pre > code {
border: 0;
margin: 0;
padding: 0;
}
img {
padding: 20px;
max-width: 80%;
height: auto;
width: auto\9;
}
td {
border: 1px solid lightGray;
padding-left: 10px;
padding-right: 10px;
min-width: 150px;
}
th {
border-bottom: 1px solid black;
padding-left: 10px;
}
del {
color: gray;
}
em {
color: #088A85;
}
#ws { background-color: #f8f8f8; }
.send { color:#77bb77; }
.server { color:#7799bb; }
.error { color:#AA0000; }
#TOC {
margin-top: 100px;
position: absolute;
left: 50px;
width: 300px;
font-size: 16px;
}
#TOC li {
padding: 0;
margin: 0
}
#TOC ul {
margin-top: 0;
margin-bottom: 0;
padding-left: 15px;
}
@media print {
#TOC {
display: none !important;
}
h2 {
page-break-before: auto;
page-break-after: avoid;
}
h2, h3, h4 {
page-break-after: avoid;
}
img {
display: block;
margin-left: auto;
margin-right: auto;
width: 4.5in;
page-break-before: auto;
page-break-after: auto;
page-break-inside: avoid;
}
table {
page-break-before: auto;
page-break-after: auto;
page-break-inside: avoid;
}
a:link, a:visited {
text-decoration: underline
}
a:link:after, a:visited:after {
content: " (" attr(href) ") ";
font-size: 90%;
}
}
@gugutz
Copy link

gugutz commented Aug 5, 2018

Thanks for sharing this!

@alecandido
Copy link

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment