The documents managed in Git are easier to maintain and update in Markdown than in Word or Excel.
However, I feel that even though Markdown is good for viewing from GitLab and other sites that render Markdown, it looks better in Word when converted to PDF using the print function for external distribution.
Therefore, I will show you how to create PDFs using an application called Marked2.
What is the Marked2?
Marked2 is a Markdown viewer app for Mac, available for purchase from the Mac App Store or via SETAPP subscription. I use it via SETAPP subscription.
If you want to render Markdown with some style, you can use a plugin for VSCode and add GitHub-style CSS, but it is quite time-consuming. It’s a lot of work, but it’s only for the first time, so I thought it was OK, but after doing it many times, it became tedious, and I started using Marked2.
Marked2 is only paid for, and you can choose GitHub-style rendering from the start, and output in HTML and docx formats in addition to PDF. This article will be in PDF, but you can also output to docx and finish in Word.
You can configure various settings from
Preferences in the
Marked menu. My recommended settings are as follows.
Style tab, change the
Default style: to GitHub; Markdown will be rendered in the same style as GitHub.
Turn on following configurations.
- Print background colors and images
- Use first H1 as fallback title
- Indicate page breaks in preview
If you turn on “Indicate page breaks in preview” option, you can see page breaks in the preview. You can insert any page breaks as needed.
Headers and Footers group, enter
%title into the
Top Left and
%page/%total into the
Bottom Right. Turn on
Include on first page.
By this configuration, Marked insert the document title at the header and the page number at the footer when it create the PDFs.
To create a PDF, select
Save PDF (Paginated) of
Export As in
Here are a few tips for creating PDFs using Marked.
Separate pages at specific locations.
In Markdown, a page break occurs there when you write following.
Include a table of contents
It won’t make a PDF bookmark, but it can generate a hyperlinked table of contents page, which will be generated in Markdown at the following location.
Print table of contents option on the
Export tab of the
Preferences window should be turned off, as the
Print table of contents option forces generation at the beginning of the document, which is not user-friendly.
Also, even if you turn off the
Page break after option, you can use it with the
<!--BREAK--> option, you can create a page dedicated to the table of contents at any location, which is easy to use.
<!--BREAK--> ## 目次 <!--TOC--> <!--BREAK-->
The headings before the
<!-- TOC-->will not be included in the table of contents, so items that you do not wish to include in the table of contents should be written before
<--TOC--> . For example.
# Check Result A.Hayashi This document summarizes the test results. ## Revision History - June 27, 2022 Newly created <!--BREAK--> ## Table of Contents <!--TOC--> <!--BREAK--> ## System Requirements The system requirements is following. ## Test result of Beta 1 No erros in Beta 1.
This is rendered in Marked with page breaks in the preview as follows.
There is a page break before and after the table of contents, which is a page dedicated to the table of contents. Also, the table of contents does not include headings such as
Revision History or
Table of Contents.