22
33#How to use this for your document (GitHub)
44
5- Write normal Markdown, with a YAML front matter with the relevant metadata. See the[ sample] ( sample ) directory for some examples.
5+ Create a private repository based on the
6+ [ example template repository] ( https://github.com/TrustedComputingGroup/specification-example ) ,
7+ or set up the GitHub action in any repository using the[ instructions below] ( #setting-up-the-github-action ) .
8+
9+ ##Document metadata
10+
11+ Write normal Markdown, with a YAML document metadata block at the top, containing the relevant metadata.
12+
13+ ````
14+ ---
15+ title: "Document Title"
16+ version: 0.1
17+ revision: 1
18+ date: 2022/09/17
19+ type: SPECIFICATION
20+ status: DRAFT
21+ ...
22+ ````
23+
24+ ` status ` can be any string, but if it is` DRAFT ` then the tool will render a watermark on the PDF.
25+
26+ ```
27+ status: DRAFT
28+ ```
29+
30+ You can specify either the` bluetop ` or` greentop ` (default) cover backgrounds with the following optional YAML metadata field:
31+
32+ ```
33+ template: bluetop
34+ ```
35+
36+ or
37+
38+ ```
39+ template: greentop
40+ ```
41+
42+ ##Separators and page breaks
43+
44+ Horizontal separators are transformed by the workflow into page breaks for readability in both GitHub and PDF views.
45+
46+ ```
47+ ---
48+ ```
49+
50+ ##Tables of contents, figures, and tables
51+
52+ Provide a table of contents, list of figures, and list of tables anywhere
53+ (usually, after the disclaimers, change history, and document-style remarks)
54+ in the document with:
55+
56+ ```
57+ ---
58+
59+ \tableofcontents
60+
61+ \listoffigures
62+
63+ \listoftables
64+
65+ ---
66+ ```
67+
68+ ##Tables
69+
70+ Tables in Markdown look like the following:
71+
72+ ```
73+ | **Revision** | **Date** | **Description** |
74+ | ------------ | ---------- | --------------- |
75+ | 0.1/1 | 2022/09/17 | Initial draft |
76+ ```
77+
78+ | ** Revision** | ** Date** | ** Description** |
79+ | ------------| ----------| ---------------|
80+ | 0.1/1| 2022/09/17| Initial draft|
81+
82+ ##Informative text blocks
683
784TCG makes use of a gray box for "informative text." To write informative text in your Markdown source, use the block-quote syntax:
885
@@ -12,6 +89,16 @@ TCG makes use of a gray box for "informative text." To write informative text in
1289> It can be multiple paragraphs, if you wish.
1390```
1491
92+ It will look like this in the GitHub markdown view:
93+
94+ > Informative text goes here!
95+ >
96+ > It can be multiple paragraphs, if you wish.
97+
98+ The tool will insert the "Start of informative text" / "End of informative text" delimiters to the informative text blocks automatically.
99+
100+ ##Diagrams
101+
15102You can include diagrams using[ Mermaid] ( https://mermaid-js.github.io/mermaid/#/ ) syntax:
16103
17104```` md
@@ -38,11 +125,27 @@ Host->>TPM: TPM2_Quote
38125TPM->>Host: <quoted PCRs>
39126```
40127
41- If a list of figures is included (` lof: true ` in the YAML preamble) then there will be a link to a figure called "Sequence Diagram A".
128+ In the example above, "Sequence Diagram A" is the name shown in the figure caption and table of figures.
129+ To exclude the caption and table-of-figures entry, leave out the caption on the first line, i.e. just:
130+ ````
131+ ```mermaid
132+ ````
42133
43- You can also include images. Note: GitHub and Pandoc disagree somewhat on the paths to images,
44- so the safest path to success is to keep the Markdown source and image files all
45- together in the** root** of the repository.
134+ Mermaid supports the following types of diagrams:
135+
136+ * Sequence diagrams (as above)
137+ * Flow charts
138+ * Gantt charts
139+ * UML class diagrams
140+ * Git branch graphs
141+ * And[ more] ( https://mermaid-js.github.io/mermaid/#/ )
142+
143+ ##Images
144+
145+ You can also include images if you check them into the root of the repository.
146+ Note: GitHub and Pandoc disagree somewhat on the paths to images,
147+ so the safest path to success is to keep the Markdown source and image files
148+ all together in the** root** of the repository.
46149
47150``` md
48151
@@ -52,12 +155,15 @@ produces:
52155
53156![ Image B] ( computer.jpg )
54157
55- If a list of figures isincluded ( ` lof: true ` in theYAML preamble) then there will be a link to a figure called "Image B" .
56-
158+ In the example above, "Image B" isthe name shown in thefigure caption and table of figures .
159+ To exclude the caption and table-of-figures entry, leave the caption blank (i.e., `  ` )
57160
161+ See the[ sample] ( sample ) directory for more examples.
58162
59163Here is an example of a GitHub Action configuration that renders a Markdown file to PDF, attaches it to the workflow, and checks it into the repo (if not a pull request):
60164
165+ #Setting up the GitHub action
166+
61167``` yaml
62168name :Render
63169
@@ -72,31 +178,29 @@ jobs:
72178render :
73179runs-on :ubuntu-latest
74180container :
75- image :ghcr.io/trustedcomputinggroup/pandoc:latest
76- permissions :
77- contents :read
78- name :Render the example text
181+ image :ghcr.io/trustedcomputinggroup/pandoc:0.3.0
182+ name :Render PDF
79183steps :
80184 -name :Checkout
81185uses :actions/checkout@v3
82186
83187 -name :Render
84- uses :trustedcomputinggroup/markdown@latest
188+ uses :trustedcomputinggroup/markdown@v0.2.5
85189with :
86- input-md :lorem .md
87- output-pdf :lorem .pdf
190+ input-md :main .md
191+ output-pdf :spec .pdf
88192
89- -name :UploadArtifact
193+ -name :Uploadsamples
90194uses :actions/upload-artifact@master
91195with :
92- name :lorem .pdf
93- path :lorem .pdf
94-
196+ name :spec .pdf
197+ path :spec .pdf
198+
95199 -name :Check in latest render
96200uses :stefanzweifel/git-auto-commit-action@v4
97201with :
98202commit_message :Generate latest PDF
99- file_pattern :lorem .pdf
203+ file_pattern :spec .pdf
100204if :github.event_name != 'pull_request'
101205` ` `
102206