TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/formsmd/formsmd/llms.txt
Use this file to discover all available pages before exploring further.
formsmd CLI tool compiles your Markdown files into static HTML pages with Forms.md functionality.
Installation
Install Forms.md globally or as a dev dependency:Basic usage
src directory and generates HTML files in the site directory.
Command
formsmd
Compile Markdown files into Forms.md HTML pages.Options
Aliases:
-iSpecifies the input directory containing your Markdown files. The CLI will process all .md files in this directory.Aliases:
-oSpecifies the output directory where HTML files will be generated. The CLI creates this directory if it doesn’t exist.Aliases:
-sName of the static directory for images, media files, and other assets. This directory is copied from the input directory to the output directory.How it works
Theformsmd CLI performs the following operations:
- Reads Markdown files - Scans the input directory for all
.mdfiles - Parses settings - Extracts Forms.md settings from
#!prefixed lines - Generates routes - Creates URL-friendly routes based on file names (slugified)
- Compiles HTML - Renders each Markdown file into a complete HTML page
- Copies assets - Copies the Forms.md library files and your static directory to output
Output structure
For an input directory with this structure:File naming
The CLI converts Markdown file names to URL-friendly routes:- Converts to lowercase
- Removes special characters
- Replaces spaces with hyphens
- Removes file extension
Examples
| Input File | Output Route |
|---|---|
Contact Form.md | contact-form.html |
Customer_Survey.md | customer-survey.html |
FAQ.md | faq.html |
Custom base template
You can provide a custombase.html file in your input directory to override the default template. The CLI uses this template for all generated pages.
Template variables
Your custombase.html can use these Nunjucks variables:
The URL-friendly route name for the current page (without file extension).
Object containing all page settings (both defaults and user-defined).Access any setting like
{{ settings.title }}, {{ settings.accent }}, etc.Usage examples
Basic build
Custom directories
In package.json scripts
With a build tool
- npm scripts
- CI/CD
Working directory
The CLI runs from your current working directory. All paths are relative to where you execute the command.Error handling
The CLI provides error messages for common issues:Unable to read input directory
Invalid Markdown syntax
If a Markdown file has syntax errors, the CLI logs the error and continues processing other files.Integration examples
Next.js
Vite
The CLI doesn’t include a watch mode. Use a tool like
nodemon or concurrently for development workflows.With nodemon for development
Best practices
-
Version control - Add the output directory to
.gitignoresince it contains generated files - Build scripts - Use npm scripts for consistent builds across environments
- Static assets - Keep all images and media in the static directory for proper copying
- File naming - Use descriptive, URL-friendly names for your Markdown files
-
Custom templates - Store your
base.htmlin version control for team consistency
Related
- Settings reference - Learn about all available settings
- Composer class - Programmatic form building
- Markdown syntax - Forms.md Markdown reference