mkdocs-semiliterate/mkdocs_semiliterate/plugin.py
Glen Whitney cf4d538fd0 feat: Add copy_standard_markdown parameter to plugin
This parameter controls whether the standard markdown extensions will
  be added to the include_extensions or not.

  Resolves #1.
2021-01-08 10:40:06 -08:00

49 lines
1.8 KiB
Python

""" md
## Usage
Once this plugin is [installed](../README.md#installation), in your `mkdocs.yml`
file just replace the plugin name `simple` with `semiliterate`. It accepts all
of the same parameters, so `mkdocs` will still work as before, and
you will have immediate access to all of the following extensions. (Note that this
documentation assumes a familiarity with the
[usage](https://athackst.github.io/mkdocs-simple-plugin/mkdocs_simple_plugin/plugin/)
of the `simple` plugin.)
### Inclusion syntax
To be documented when implemented.
"""
import mkdocs
from mkdocs.config import config_options
from mkdocs_simple_plugin.plugin import SimplePlugin
class SemiliteratePlugin(SimplePlugin):
""" md An extension of the mkdocs-simple-plugin
### Additional plugin parameters
`semiliterate` adds a couple of new plugin parameters to further tailor its
behavior as compared to `simple`. They are described in this section, with their
default values in parentheses at the beginning of each entry.
copy_standard_markdown
: (false) Whether to add MkDocs' list of standard Markdown extensions to the
`include_extensions` parameter so that Markdown files will be directly copied
to the docsite. Note that the `simple` behavior corresponds to a _true_ value
for `copy_standard_markdown`, but `semiliterate` still incorporates all
standard Markdown files because of the `extract_standard_markdown` default.
extract_standard_markdown
: (true) To be implemented and documented
"""
config_scheme = (
*SimplePlugin.config_scheme,
('copy_standard_markdown', config_options.Type(bool, default=False))
)
def copy_doc_files(self, destination_directory):
if not self.config['copy_standard_markdown']:
self.include_extensions = self.config['include_extensions']
return super().copy_doc_files(destination_directory)