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.
This commit is contained in:
Glen Whitney 2021-01-08 10:40:06 -08:00
parent ec9c7e57ce
commit cf4d538fd0
3 changed files with 42 additions and 8 deletions

View File

@ -6,13 +6,18 @@ plugins:
- search - search
- semiliterate: - semiliterate:
merge_docs_dir: false merge_docs_dir: false
ignore_folders: [dist] ignore_folders: [dist, build]
include_extensions: [LICENSE] include_extensions: [LICENSE]
# semiliterate: semiliterate:
# - pattern: '(\.md)$' - pattern: '(\.md)$'
# replace: [['^(.*)<!-- repo: -->.*<!-- site:(.*?) -->(.*\s*)$', '\1\2\3']] start: '^(.*\s*)'
replace: [['^(.*)<!-- repo: -->.*<!-- site:(.*?) -->(.*\s*)$', '\1\2\3']]
- pattern: '(\.py)$'
start: '"""\smd'
stop: '"""'
markdown_extensions: markdown_extensions:
- abbr - abbr
- def_list
theme: theme:
name: readthedocs name: readthedocs
docs_dir: mkdocs_semiliterate # dummy docs_dir: mkdocs_semiliterate # dummy

View File

@ -3,8 +3,11 @@
Once this plugin is [installed](../README.md#installation), in your `mkdocs.yml` Once this plugin is [installed](../README.md#installation), in your `mkdocs.yml`
file just replace the plugin name `simple` with `semiliterate`. It accepts all file just replace the plugin name `simple` with `semiliterate`. It accepts all
of the same parameters as `simple`, so `mkdocs` will still work as before, and of the same parameters, so `mkdocs` will still work as before, and
you will have immediate access to all of the following extensions: 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 ### Inclusion syntax
@ -16,4 +19,30 @@ from mkdocs.config import config_options
from mkdocs_simple_plugin.plugin import SimplePlugin from mkdocs_simple_plugin.plugin import SimplePlugin
class SemiliteratePlugin(SimplePlugin): class SemiliteratePlugin(SimplePlugin):
""" So far, just an alias for simple """ """ 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)

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = mkdocs-semiliterate name = mkdocs-semiliterate
version = 0.0.1 version = 0.0.3
[options] [options]
packages = mkdocs_semiliterate packages = mkdocs_semiliterate