Usage: The wmk command
The wmk
command structure is wmk <action> <base_directory>
. The base
directory is of course the directory containing the source files for the site.
(They are actually in subdirectories such as templates
, content
, etc. –
see File organization).
-
wmk info $basedir
: Shows the real path to the location ofwmk.py
and of the content base directory. E.g.wmk info .
. Synonyms forinfo
areenv
anddebug
. -
wmk init $basedir
: In a folder which containscontent/
(with markdown or HTML files) but nowmk_config.yaml
, creates some initial templates as well as a samplewmk_config.yaml
, thus making it quicker for you to start a new project. -
wmk build $basedir [-q|--quick]
: Compiles/copies files into$basedir/htdocs
. If-q
or--quick
is specified as the third argument, only files considered to have changed, based on timestamp checking, are processed. Synonyms forrun
arerun
,b
andr
. -
wmk watch $basedir
: Watches for changes in the source directories inside$basedir
and recompiles if changes are detected. (Note thatbuild
is not performed automatically before setting up file wathcing, so you may want to run that first). A synonym forwatch
isw
. -
wmk serve $basedir [-p|--port <portnum>] [-i|--ip <ip-addr>]
: Serves the files in$basedir/htdocs
onhttp://127.0.0.1:7007/
by default. The IP and port can be modified with the-p
and-i
switches or be be configured viawmk_config.yaml
– see Configuration file). Synonyms forserve
aresrv
ands
. -
wmk watch-serve $basedir [-p|--port <portnum>] [-i|--ip <ip-addr>]
: Combineswatch
andserve
in one command. Synonym:ws
. -
wmk clear-cache $basedir
: Remove the HTML rendering cache, which is a SQLite file in$basedir/tmp/
. This should only be necessary in case of changed shortcodes or shortcode dependencies. Note that the cache can be disabled inwmk_config.yaml
by settinguse_cache
tofalse
, or on file-by-file basis via a frontmatter setting (no_cache
). A synonym forclear-cache
isc
. -
wmk preview $basedir $filename
where$filename
is the name of a file relative to thecontent
subdirectory of$basedir
. This prints (to stdout) the HTML which the given file will be converted to (before it is passed to the template and before potential post-processing). Example:wmk preview . index.md
. -
wmk admin $basedir
: Build the site and then start wmkAdmin, which must have been installed beforehand into theadmin
subdirectory of the$basedir
(or into the subdirectory specified withwmk admin $basedir $subdir
). The subdirectory may be a symbolic link pointing to a central instance. wmkAdmin allows you to manage the content of the site via a web interface. It is not designed to allow you to install or modify themes or perform tasks that require more technical knowledge, and works best for a standard site based on Markdown or HTML files in thecontent
directory. -
wmk repl $basedir
: Launch a Python shell (ipython, bpython or python3, in order of preference) with the wmk environment loaded and with the$basedir
as current working directory. Useful for examining wmk's view of the site content or debuggingMDContent
filtering methods. For these purposes,from wmk import get_content_info
, followed bycontent = get_content_info('.')
is often a good start. -
wmk pip <pip-command>
: Runpip
in the virtual environment used by wmk. Mainly useful for installing or upgrading Python modules that you want to use in Python files belonging to your projects. -
wmk homedir
: Outputs the path towmk
's installation directory. May be useful in shell scripts.