Configuration
All Markdoc wikis are configured via a single markdoc.yaml file in the wiki
root. This file is formatted with YAML (Yet Another Markup Language); you can
find more information on that at yaml.org. When running the
command-line interface, Markdoc will search for either a markdoc.yaml or a
.markdoc.yaml file in the current directory. You can also explicitly specify a
file to use with the -c/--config command-line option.
Example
Here we’ll go through an example and show how the various settings affect Markdoc’s behavior:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | # Metadata wiki-name: "My Wiki" google-analytics: UA-XXXXXX-X # Directories hide-prefix: "." wiki-dir: "wiki" static-dir: "static" html-dir: ".html" template-dir: ".templates" temp-dir: ".tmp" # Building document-extensions: [.md, .mdown, .markdown, .wiki, .text] generate-listing: always listing-filename: "_list.html" use-default-static: true use-default-templates: true # Rendering markdown: safe-mode: false output-format: xhtml1 extensions: [codehilite, def_list] extension-configs: codehilite: force_linenos: true # Serving server: bind: '127.0.0.1' port: 8010 num-threads: 10 name: 'server.example.com' request-queue-size: 5 timeout: 10 |
Remember that Markdoc uses sensible defaults for all of these options, so it’s perfectly OK to have an empty markdoc.yaml file. You still need one though.
Metadata
This is information about your wiki itself. It is currently only used when rendering the default set of templates, but custom templates may also use these parameters.
wiki-name(no default)- Specify the human-friendly name of your wiki. If defined, this will appear in the title and footer in the default Markdoc templates.
google-analytics(no default)- Specify a Google Analytics tracking key for your Markdoc site. If given,
the GA tracking code will be included in every HTML document. Note that this
should be the full key, in the format
UA-XXXXXX-X.
Directories
These settings affect where Markdoc looks for some pieces of data, and where it
puts others. You can get more information on the roles of various directories in
the layout documentation. Note that all *-dir parameters are
resolved relative to the wiki root, and that '.' (i.e. the wiki root itself)
is an acceptable value.
hide-prefix(default.)- This determines how Markdoc finds and writes to hidden directories like
.tmp,.templatesand.html. You may wish to set this to'_'if your VCS or operating system doesn’t play nicely with period-prefixed filenames. If you specifyhtml-dir,temp-dirandtemplate-dir, this setting won’t have any effect. wiki-dir(default"wiki")- This tells Markdoc where to find pages that should be rendered with Markdown and output as HTML. Only files in this directory will be rendered.
static-dir(default"static")- Any files in the static directory are synced over to the HTML root as-is when building. This tells Markdoc where to find all the static media for your wiki.
html-dir(defaulthide-prefix + "html")- This is where HTML and static media are eventually output during the
building process. It is also the document root for the Markdoc server. The
default value is auto-generated using the
hide-prefixsetting. template-dir(defaulthide-prefix + "templates")- Markdoc will look in this directory first when searching for the Jinja2 templates needed to produce HTML.
temp-dir(defaulthide-prefix + "tmp")- This directory is used as a temporary destination when building HTML.
Building
These settings affect Markdoc’s behavior during the build process.
document-extensions(default[.md, .mdown, .markdown, .wiki, .text])- Markdoc will only render files from the document root which have one of
these extensions. If one of the extensions is an empty string (
''), then all files (including those without an extension) will be considered pages. Setting this parameter to the empty list ([]) will behave as if it is actually['']. generate-listing(defaultalways)-
This affects how listings are generated for directories in your Markdoc wiki (including the top level). Set this to either
always,sometimesornever. The semantics are as follows:nevernever generates any listings.sometimesonly generates a listing when there is noindexorindex.htmlfile in a directory. This listing is saved as bothindex.htmland the value of thelisting-filenamesetting.alwaysgenerates a listing for every directory, and saves it under the value of thelisting-filenamesetting, and asindex.htmlif an index file does not already exist.
listing-filename(default_list.html)-
This specifies the filename that directory listings are saved under; see the documentation for
generate-listingjust above for more information. use-default-static(defaulttrue)-
If true, Markdoc’s default set of static media will be synchronized to the HTML root when building.
use-default-templates(defaulttrue)-
If true, Jinja2 will look in Markdoc’s set of default templates when rendering documents and listings.
Rendering
These settings determine how Markdoc converts Markdown text into XHTML. They are
all defined as sub-parameters inside the markdown dictionary. These parameters
correspond to keyword arguments to the markdown.Markdown constructor, although
hyphens (-) are all converted to underscores (_) in the key strings.
extensions(default[])-
A list of strings specifying extensions to be used by the Markdown renderer. The Markdown library for Python comes with the following by default:
abbrcodehilitedef_listextrafenced_codefootnotesheaderidhtml_tidyimagelinksmetarsstablestocwikilinks
extension-configs(default{})-
These are configuration parameters for the extensions — you’ll need to consult the official Markdown library documentation for more information.
safe-mode(defaultfalse)-
Disallow raw HTML in Markdown documents. This can be either
false,remove,replaceorescape. output-format(defaultxhtml1)-
Switch between rendering XHTML or HTML. Can be either
xhtml1,xhtml,html4orhtml(the general ones will always refer to the latest version). It is strongly suggested that you use XHTML.
Serving
All of the server configuration parameters exist in the server dictionary (as
with markdown previously).
bind(default127.0.0.1)- Bind to the specified interface. With the default value the server will only listen on the loopback interface (localhost).
port(default8008)- Listen on the specified port.
num-threads(default10)- Use this number of threads to handle requests.
name(default is autodetected)- Specify a server name. The default will be automatically detected from the socket the server binds to.
request-queue-size(default5)- Sets the number of queued connections to the server before it will start
dropping TCP connections (the
backlogargument tosocket.listen()). timeout(default10)- The socket timeout (in seconds) for accepted TCP connections.