Amatl VS Code Extension
Convert your Markdown files into HTML and PDF with Amatl!
📜 Amatl
This extension is based on Amatl, a binary tool that allows you to convert your Markdown files into HTML and PDF formats.
Transform your CommonMark (also known as Markdown) files into full-fledged documents from the command line.
Why the name amatl
?
Amate (Spanish: amate [aˈmate]
, from Nahuatl languages: āmatl [ˈaːmat͡ɬ]
) is a type of bark paper that has been manufactured in Mexico since pre-Columbian times. It was primarily used to create codices.
Source: Wikipedia
✨ Features
- Create documents from local or remote resources via URL resolving.
- Integrate MermaidJS diagrams and code blocks with syntax highlighting.
- Use custom directives to include other documents or generate tables of contents.
- Use pre-defined or custom layouts to transform your content into presentations, reports, etc.
- Use Go templating to inject dynamic data into your document.
🚀 How to Use
⚠ Caution
This project is in its early stages and subject to rapid evolution. Expect frequent changes and potential instability.
- Download the latest release of
amatl
.
- In your terminal, start transforming your documents into HTML:
amatl render html my-doc.md
See doc
for more information.
⚡ Extension Features
✅ Automatic HTML and PDF generation upon saving.
✅ Advanced management of excluded files.
✅ Custom styling with a dedicated CSS file.
✅ Easy to use with a simple installation.
📦 Installation
- Download and install the extension from VS Code Marketplace.
- Configure your amatl.configDirectory if you wants witch your own template and style
- Open a Markdown file and save it to generate HTML/PDF.
- Use Amatl Sidebar for insert directives
- Add your own directives
- tape ./ or ../ to autocomple a route file
⚙️ Configuration
📝 amatl.generateHtmlOnSave
Enable HTML generation when saving a Markdown file.
📂 amatl.htmlDirectory
Target path to the generate html. If empty, in the same place of the md.
📄 amatl.generatePdfOnSave
Enable PDF generation when saving a Markdown file.
📂 amatl.pdfDirectory
Target path to the generate pdf. If empty, in the same place of the md.
📂 amatl.configDirectory
Path to an Amatl configuration directory. If empty, the default configuration is used.
config.yml
Which allows you to customize the execution of Amatl:
html-layout: ./template.gohtml
pdf-scale: 0.7
pdf-margin-left: 1.0
pdf-margin-right: 1.0
template.gohtml
The template used for document generation.
<html>
<head>
<title>{{ .Meta.title }}</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="{{ resolve .Context "./theme.css" }}" />
</head>
<body>
{{ .Body }}
</body>
</html>
theme.css
Your theme
body {
font-family: "Roboto" !important;
color: [#333](https://github.com/afornerot/amatl-vscode/issues/333);
max-width: 1200px;
margin: auto;
padding:10px;
}
noreplace.txt
Exclude file md to transform to html/pdf
readme.md
mydir/other.md
directives.json
You can add directive to Amatl sidebar
[
{
"name": "Break Page",
"code": "<div class='break-page'></div>",
"replacePattern": "",
"description": "Break Page"
}
]
⚙️ Commands
- amatl.reloadDirectives = Reload directive
- amatl.generateHtml = Generate the html of the current md
- amatl.generatePdf = Generate the pdf of the current md
📜 License
MIT