title | author | lang | subject | keywords | default_ | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Markdown Converter |
|
en |
pandoc |
|
report |
Markdown Converter (mdc) compiles plaintext documents from Markdown into other formats using Pandoc + Makefile + Bash
I use these scripts to convert my Markdown files into other formats at work and on my home computer. The Windows installation process does not require administrator privileges at any step, so the IT department doesn't disallow it.
- Install Pandoc for Windows
- Install MiKTeX (LaTeX for Windows)
- Install MSYS2 (Linux build tools for Windows)
- Install Git, Makefile, and WatchExec: In MSYS2 UCRT64, run
pacman -S git make mingw-w64-ucrt-x86_64-watchexec
- Clone this repository: In MSYS2 UCRT64,
cd
to the directory you want to install this repository and rungit clone https://github.com/mboyea/mdc
- In
C:\msys64\home\<user>\.bashrc
add linealias mdc='<INSERT_PATH_TO_PANDOC_SCRIPTS>/mdc/mdc.sh'
- In
C:\msys64\home\<user>\.bash_profile
add lineif [ -f ~/.bashrc ]; then . ~/.bashrc; fi
- In
C:\msys64\ucrt64.ini
uncomment lineMSYS2_PATH_TYPE=inherit
Now you can use mdc
in the MSYS2 UCRT64 terminal to process your documents.
This terminal is capable of running most other Linux tools too, natively in Windows (without WSL).
You can find the package list on msys2.org, or search the database with the terminal using pacman -Ss string1 string2 ...
.
My favorite Windows text editor is Visual Studio Code
- Open VSCode
- Open
User Settings (JSON)
usingCtrl+Shift+P
- Add lines:
// "terminal.integrated.shellIntegration.enabled": false, // fix slow terminals
"terminal.integrated.profiles.windows": {
"MSYS2": {
"path": "C:\\msys64\\usr\\bin\\bash.exe",
"args": [
"--login"
],
"env": {
"MSYSTEM": "UCRT64",
"MSYS2_PATH_TYPE": "inherit",
"CHERE_INVOKING": "1",
}
}
},
"terminal.integrated.env.windows": {
// "HOME": "C:\\path\\to\\custom\\home\\dir", // change home directory (make sure to create a .bashrc and .bash_profile)
"MSVSCODE": "1"
},
"terminal.integrated.defaultProfile.windows": "MSYS2",
"settingsSync.ignoredSettings": [
"terminal.integrated.profiles.windows",
"terminal.integrated.env.windows",
"terminal.integrated.defaultProfile.windows"
]
- Save the file.
Now MSYS2 UCRT64 is your default terminal in VSCode.
Open it with Ctrl+Shift+`
.
- Run
pacman -S texlive-basic texlive-latexrecommended texlive-latexextra texlive-fontsrecommended
- Install Pandoc: Get
pandoc-bin
from AUR orpandoc-cli
from pacman (do not install both) - Clone this repository: In your shell,
cd
to the directory you want to install this repository and rungit clone https://github.com/mboyea/mdc
- In your
.bashrc
, add linealias mdc='<INSERT_PATH_TO_PANDOC_SCRIPTS>/mdc/mdc.sh'
- In your
.bash_profile
add lineif [ -f ~/.bashrc ]; then . ~/.bashrc; fi
- Add packages to the config file:
git
pandoc
texliveFull
gnumake
- Rebuild the config file with
home-manager switch
. - Clone this repository: In your shell,
cd
to the directory you want to install this repository and rungit clone https://github.com/mboyea/mdc
- In your
.bashrc
, add linealias mdc='<INSERT_PATH_TO_PANDOC_SCRIPTS>/mdc/mdc.sh'
- In your
.bash_profile
add lineif [ -f ~/.bashrc ]; then . ~/.bashrc; fi
In the terminal, run mdc --help
to view the script list.
Run mdc <script-name> --help
to view supported usage of any script.
script call | description |
---|---|
mdc help |
Print the script list, or print help for a specific script. |
mdc pdf |
Compile %.md files (Markdown) into %.pdf files (Portable Display Format). |