Making a book from (examples) markdown
I want to make a book from my RSCG examples https://github.com/ignatandrei/RSCG_Examples . The easy way is to transform the .md files into separate chapters.
I have tried initially node with markdown-pdf and pdf-merger-js , but I have been going then full speed with pandoc . To generate both Word and Index.md I have used this:
pandoc.exe -d pandocHTML.yaml -o ../docs/index.md -t gfm
pandoc.exe -d pandocHTML.yaml -o ../docs/index.docx
The pandocHTML.yaml is here:
from: gfm
# reader: may be used instead of from:
# to: docx
# output-file: index.docx
# to: gfm
# output-file: ../docs/index.md
# writer: may be used instead of to:
# leave blank for output to stdout:
reference-doc: customWord.docx
# leave blank for input from stdin, use [] for no input:
input-files:
– ../book/about.md
– ../book/whatIs.md
– ../ApplicationVersion/README.md
– ../Enum/README.md
– ../JsonToClass/README.md
– ../CopyConstructor/README.md
– ../DTOMapper/readme.md
– ../SkinnyControllers/README.md
– ../DP_Builder/readme.md
– ../MetadataFromObject/README.md
– ../DynamicMocking/readme.md
– ../MethodDecorator/README.md
– ../PartiallyFunction/readme.md
– ../IFormattable/readme.md
– ../DP_Decorator/README.md
– ../PropertyExpressionGenerator/readme.md
– ../book/others.md
– ../book/conclusion.md
# or you may use input-file: with a single value
# defaults:
# – customWord.docx
standalone: true
self-contained: true
# metadata values specified here are parsed as literal
# string text, not markdown:
metadata:
title: RSCG Examples
author:
– Andrei Ignat
# Note that these take files, not their contents:
include-before-body: []
include-after-body: []
include-in-header: []
resource-path: [“.”]
# ERROR, WARNING, or INFO
verbosity: INFO
log-file: log.json
table-of-contents: true
toc-depth: 3
# number-sections: true
# a list of offsets at each heading level
number-offset: [0,0,0,0,0,0]
# toc: may also be used instead of table-of-contents:
shift-heading-level-by: 1
section-divs: true
identifier-prefix: foo
title-prefix: “”
strip-empty-paragraphs: true
# lf, crlf, or native
eol: lf
strip-comments: false
indented-code-classes: []
ascii: true
default-image-extension: “.jpg”
fail-if-warnings: false
dump-args: false
ignore-args: false
trace: false
As you see , I have put the .md files to be processed. Another thing that I have the need is to have a custom word template – to put page breaks after Heading 2. You can download from https://github.com/ignatandrei/RSCG_Examples/blob/main/print/customWord.docx
Leave a Reply