A Dotfiles Demo
A functional demo of markdown-managed dotfiles.
- `.env` (optional) set key-value pairs for replacement
- `**/*.md` dotfiles stored as markdown
npx dotfiles-md --demo
tip: View the raw markdown file to see the metadata on each codeblock
A codeblock without an action=*
annotation does nothing and won't appear in the CLI
_sometimes you don't want to run a code block_
All blocks support replacements when they're read from your own .env
file
// source: demo/README.md using demo/.env
console.log("hello world", "%S3_BUCKET");
# Build
The basic build action converts a block of code into a file.
> source: `dotfiles-md-hello-symlink.md` https://www.npmjs.com/package/dotfiles-md?activeTab=code
# Hello World!
This built dotfile comes from the `action=build example.md` file of the library.
With action=build, files are built directly to the location specified in the code block's metadata.
# Run
The action=run
flag executes the codeblock with an interpreter appropriate to the syntax of the code block. These code blocks do not use the filePath
metadata.
for an up-to-date list of available interpreters, consult the API.ts
codebase.
echo "Hello BASH";
console.log("Hello NODE!");
echo "Hello SHELL"
echo "Hello SHELL"
# Symlink
The action=symlink
file will creates a file in /build/{timestamp}/
for the code block and creates a symlink at the specified specified location.
You can use
$HOME
to refer to the home directory as in$HOME/.gitconfig
for your global git config.
> source: `demo/README.md` https://www.npmjs.com/package/dotfiles-md?activeTab=code
# Hello Symlink!
As a result of action=symlink, the contents of this file lives in a build directory (relative to where you ran `dotfiles-md`), and a symlink was created in the specified location.
This example creates a file in your home directory ~/dotfiles-md-hello-symlink.md
symlinked to ./build/{timestamp}/{#}-dotfiles-md-hello-symlink.md
(the file counter is used to dedupe potential naming conflicts).
> source: `demo/README.md` https://www.npmjs.com/package/dotfiles-md?activeTab=code
# Hello Symlink – Home Directory!
As a result of action=symlink, the contents of this file lives in a build directory (relative to where you ran `dotfiles-md`), and a symlink was created in the specified location (`$HOME/dotfiles-md-hello-symlink.md`).