Skip to contentSkip to conversation

secilc/docs: disable pandoc default css for html docs

PATCH In review bauen1 2 participants 3 messages Aug 28, 2022 – Sep 1, 2022 SELinux security module

lore
Share & tools
lore

bauen1

author
#0 lore raw

PATCH 3/3 secilc/docs: disable pandoc default css for html docs

Some time ago pandoc started shipping a default css file for html, while that is nice, it limits the max-width of the body element to 36em. We have a lot of tables, code examples, etc... in the manual that are too big for that, requiring constant scrolling.

See https://github.com/jgm/pandoc/blob/master/data/templates/styles.html
for the default used.

While some styling, perhaps even dark/light mode support in the CSS would be nice, I didn't manage to find a simple way to achieve this, so for now just disable the CSS.

Expand the arguments for pandoc in the Makefile for better readability.

---
 secilc/docs/Makefile | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)
secilc/docs/Makefile +16 -2
index a03ebeed..7e2ba40e 100644
@@ -58,11 +58,25 @@ $(TMPDIR)/policy.cil: $(TESTDIR)/policy.cil
 
 html: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil secil.xml
 	mkdir -p $(HTMLDIR)
-	$(PANDOC) --highlight-style=$(PANDOC_HIGHLIGHT_STYLE) --syntax-definition=secil.xml --standalone --metadata title="CIL Reference Guide" -t html $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil  -o $(HTMLDIR)/$(HTML_OUT)
+	$(PANDOC) \
+		--highlight-style=$(PANDOC_HIGHLIGHT_STYLE) \
+		--syntax-definition=secil.xml \
+		--standalone \
+		--metadata title="CIL Reference Guide" \
+		--metadata document-css=false \
+		-t html \
+		$(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil \
+		-o $(HTMLDIR)/$(HTML_OUT)
 
 pdf: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil secil.xml
 	mkdir -p $(PDFDIR)
-	$(PANDOC) --highlight-style=$(PANDOC_HIGHLIGHT_STYLE) --syntax-definition=secil.xml --standalone --toc $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil -o $(PDFDIR)/$(PDF_OUT)
+	$(PANDOC) \
+		--highlight-style=$(PANDOC_HIGHLIGHT_STYLE) \
+		--syntax-definition=secil.xml \
+		--standalone \
+		--toc \
+		$(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil \
+		-o $(PDFDIR)/$(PDF_OUT)
 
 clean:
 	rm -rf $(HTMLDIR)

--
2.36.1

Acked-by on v1 3/3
#1 lore raw
Quoted 9 lines · On Sun, Aug 28, 2022 at 8:16 AM bauen1 <[email protected]> wrote:

Some time ago pandoc started shipping a default css file for html, while that is nice, it limits the max-width of the body element to 36em. We have a lot of tables, code examples, etc... in the manual that are too big for that, requiring constant scrolling.

See https://github.com/jgm/pandoc/blob/master/data/templates/styles.html
for the default used.

Quoted 7 lines

While some styling, perhaps even dark/light mode support in the CSS would be nice, I didn't manage to find a simple way to achieve this, so for now just disable the CSS.

Expand the arguments for pandoc in the Makefile for better readability.

Quoted 39 lines
---
  secilc/docs/Makefile | 18 ++++++++++++++++--
  1 file changed, 16 insertions(+), 2 deletions(-)
secilc/docs/Makefile +16 -3
index a03ebeed..7e2ba40e 100644
@@ -58,11 +58,25 @@ $(TMPDIR)/policy.cil: $(TESTDIR)/policy.cil
 
  html: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil secil.xml
        mkdir -p $(HTMLDIR)
-       $(PANDOC) --highlight-style=$(PANDOC_HIGHLIGHT_STYLE) --syntax-definition=secil.xml --standalone --metadata title="CIL Reference Guide" -t html $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil  -o $(HTMLDIR)/$(HTML_OUT)
+       $(PANDOC) \
+               --highlight-style=$(PANDOC_HIGHLIGHT_STYLE) \
+               --syntax-definition=secil.xml \
+               --standalone \
+               --metadata title="CIL Reference Guide" \
+               --metadata document-css=false \
+               -t html \
+               $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil \
+               -o $(HTMLDIR)/$(HTML_OUT)
 
  pdf: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil secil.xml
        mkdir -p $(PDFDIR)
-       $(PANDOC) --highlight-style=$(PANDOC_HIGHLIGHT_STYLE) --syntax-definition=secil.xml --standalone --toc $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil -o $(PDFDIR)/$(PDF_OUT)
+       $(PANDOC) \
+               --highlight-style=$(PANDOC_HIGHLIGHT_STYLE) \
+               --syntax-definition=secil.xml \
+               --standalone \
+               --toc \
+               $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil \
+               -o $(PDFDIR)/$(PDF_OUT)
 
  clean:
        rm -rf $(HTMLDIR)
--

2.36.1

#2 lore raw
Quoted 15 lines · James Carter
Quoted 13 lines · On Sun, Aug 28, 2022 at 8:16 AM bauen1 <[email protected]> wrote:

Some time ago pandoc started shipping a default css file for html, while that is nice, it limits the max-width of the body element to 36em. We have a lot of tables, code examples, etc... in the manual that are too big for that, requiring constant scrolling.

See https://github.com/jgm/pandoc/blob/master/data/templates/styles.html
for the default used.

While some styling, perhaps even dark/light mode support in the CSS would be nice, I didn't manage to find a simple way to achieve this, so for now just disable the CSS.

Quoted 6 lines
Quoted 3 lines

Expand the arguments for pandoc in the Makefile for better readability.

This patch has been merged.
Thanks,
Jim

Quoted 39 lines
Quoted 39 lines
---
  secilc/docs/Makefile | 18 ++++++++++++++++--
  1 file changed, 16 insertions(+), 2 deletions(-)
secilc/docs/Makefile +16 -3
index a03ebeed..7e2ba40e 100644
@@ -58,11 +58,25 @@ $(TMPDIR)/policy.cil: $(TESTDIR)/policy.cil
 
  html: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil secil.xml
        mkdir -p $(HTMLDIR)
-       $(PANDOC) --highlight-style=$(PANDOC_HIGHLIGHT_STYLE) --syntax-definition=secil.xml --standalone --metadata title="CIL Reference Guide" -t html $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil  -o $(HTMLDIR)/$(HTML_OUT)
+       $(PANDOC) \
+               --highlight-style=$(PANDOC_HIGHLIGHT_STYLE) \
+               --syntax-definition=secil.xml \
+               --standalone \
+               --metadata title="CIL Reference Guide" \
+               --metadata document-css=false \
+               -t html \
+               $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil \
+               -o $(HTMLDIR)/$(HTML_OUT)
 
  pdf: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil secil.xml
        mkdir -p $(PDFDIR)
-       $(PANDOC) --highlight-style=$(PANDOC_HIGHLIGHT_STYLE) --syntax-definition=secil.xml --standalone --toc $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil -o $(PDFDIR)/$(PDF_OUT)
+       $(PANDOC) \
+               --highlight-style=$(PANDOC_HIGHLIGHT_STYLE) \
+               --syntax-definition=secil.xml \
+               --standalone \
+               --toc \
+               $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil \
+               -o $(PDFDIR)/$(PDF_OUT)
 
  clean:
        rm -rf $(HTMLDIR)
--

2.36.1