From 4a4241a4e4c48c5f298703285a5a47edf6425105 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Wed, 9 Nov 2022 20:52:47 +0000 Subject: [PATCH] chore: Update to mkdocs-simple v2.1.2 (#23) Note the upstream refactor from mkdocs-simple v1 -> v2 was fairly large, so this is a rather larger update than most. And in fact one feature of mkdocs-semiliterate (universal markdown extraction) was incorporated into mkdocs-simple, so the initialization of this plugin is noticeably simplified as a result. Also updates mkdocs to 1.4. Co-authored-by: Glen Whitney Reviewed-on: https://code.studioinfinity.org/glen/mkdocs-semiliterate/pulls/23 --- .drone.yml | 2 +- README.md | 3 +- mkdocs.yml | 1 + mkdocs_semiliterate/plugin.py | 168 +++++++++++------- setup.cfg | 6 +- .../extract-inclusion/refsite/css/base.css | 26 +-- .../full-inclusion/refsite/css/base.css | 26 +-- .../git-inclusion/refsite/css/base.css | 26 +-- .../no-extract-inclusion/refsite/css/base.css | 26 +-- .../quoted-filename/refsite/css/base.css | 26 +-- .../recursive-inclusion/refsite/css/base.css | 26 +-- .../sibling-destination/refsite/css/base.css | 26 +-- tests/fixtures/theme-modification/mkdocs.yml | 3 +- 13 files changed, 218 insertions(+), 147 deletions(-) diff --git a/.drone.yml b/.drone.yml index 34a65a3..40edd55 100644 --- a/.drone.yml +++ b/.drone.yml @@ -86,7 +86,7 @@ steps: # [repository site](https://code.studioinfinity.org/glen/mkdocs-semiliterate). # Pull requests are welcome as well. If you're new to contributing to open-source # projects, `mkdocs-simple-plugin` has a very nice -# [tutorial](https://athackst.github.io/mkdocs-simple-plugin/CONTRIBUTING/). +# [tutorial](https://althack.dev/mkdocs-simple-plugin/v{! setup.cfg { extract: {start: 'mkdocs~=', stop: '(\d*\.\d*\.?\d*)'}, ensurelines: false} !}/CONTRIBUTING/). # # ### Publishing # diff --git a/README.md b/README.md index 0e91e8f..11d952a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # ![Dreaming of integrated documentation](assets/icons8-ask-question-100.png) MkDocs semiliterate Plugin -This plugin for [MkDocs](http://mkdocs.org) is an extension of Allison Thackston's excellent [mkdocs-simple-plugin](https://athackst.github.io/mkdocs-simple-plugin). It allows you to include content from one file into another (via `{! ... !}` syntax), using exactly the same extraction specification that the `simple` plugin already uses for identifying documentation in source files. +This plugin for [MkDocs](http://mkdocs.org) is an extension of Allison Thackston's excellent [mkdocs-simple-plugin](https://www.althack.dev/mkdocs-simple-plugin/). It allows you to include content from one file into another (via `{! ... !}` syntax), using exactly the same extraction specification that the `simple` plugin already uses for identifying documentation in source files. + ## Rationale diff --git a/mkdocs.yml b/mkdocs.yml index 4f489a2..71b1352 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -8,6 +8,7 @@ plugins: - semiliterate: merge_docs_dir: false ignore_folders: [build, dist, tests, semiliterate] + ignore_hidden: false include_extensions: [LICENSE, '.png'] extract_standard_markdown: extract: diff --git a/mkdocs_semiliterate/plugin.py b/mkdocs_semiliterate/plugin.py index ba6f91a..b04c838 100644 --- a/mkdocs_semiliterate/plugin.py +++ b/mkdocs_semiliterate/plugin.py @@ -1,4 +1,4 @@ -""" md +r""" md ## Usage Once this plugin is [installed](../README.md#installation), just replace @@ -6,14 +6,19 @@ the plugin name `simple` with `semiliterate` in your `mkdocs.yml` file. 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/) +[usage](https://althack.dev/mkdocs-simple-plugin/v{! ../setup.cfg { + extract: {start: 'mkdocs~=', stop: '(\d*\.\d*\.?\d*)'}, + ensurelines: false +} !}/mkdocs_simple_plugin/plugin/) of the `simple` plugin.) """ from mkdocs import utils from mkdocs.config import config_options from mkdocs_simple_plugin.semiliterate import ( - Semiliterate, LazyFile, ExtractionPattern, StreamExtract, get_line) + Semiliterate, LazyFile, ExtractionPattern, StreamExtract, + get_line, get_match) +from mkdocs_simple_plugin.simple import Simple from mkdocs_simple_plugin.plugin import SimplePlugin import os @@ -32,6 +37,15 @@ to replace_line method. # except as marked: def replace_line(self, line, ensure_line=True): """Apply the specified replacements to the line and return it.""" + # Process trimming + if self._trim: + line = line[self._trim:] + # Process inline content regex + if self._content: + match_object = get_match(self._content, line) + if match_object.lastindex: + return match_object[match_object.lastindex] + # Perform replace operations: if not self.replace: return line for item in self.replace: @@ -72,7 +86,7 @@ enclosed in single or double quotes. Note that FILENAME is interpreted relative to the directory in which the file containing the `{! .. !}` expression resides. The YAML is interpreted exactly as the extraction options to a `semiliterate` item as -[documented](https://athackst.github.io/mkdocs-simple-plugin/mkdocs_simple_plugin/plugin/index.html#semiliterate) +[documented](https://althack.dev/mkdocs-simple-plugin/v{! ../setup.cfg { extract: {start: 'mkdocs~=', stop: '(\d*\.\d*\.?\d*)'}, ensurelines: false} !}/mkdocs_simple_plugin/plugin/index.html#semiliterate) for the `simple` extension, subject to the extensions below. The text extracted from FILENAME is interpolated at the current location in the file currently being written. Recursive inclusion is supported. @@ -86,9 +100,7 @@ For an example that uses more of the extraction parameters, the current version number of mkdocs-semiliterate is extracted into the [Overview](../README.md) of this documentation via -` {! ../README.md extract: { start: 'repo:.*(\{!.*!\})', stop: '' } -terminate: Rationale -!}` +` {! ../README.md extract: { start: 'repo:.*(\{!.*!\})', stop: 'repo' } !}` to take advantage of the beginning of the `setup.cfg` file: ``` @@ -270,19 +282,17 @@ anticipated by the `{%- block ... %}` directives placed by the theme writer. self.wrote_something = True self.transcribe(remainder[body_match.end():]) - # ## The following has to be identical to StreamExtract.check_pattern + # ## The following has to be identical to StreamExtract.try_extract_match # ## except for the marked bit handling ensure_lines - def check_pattern(self, pattern, line, emit_last=True): - """Check if pattern is contained in line. + def try_extract_match( + self, + match_object: re.Match, + emit_last: bool = True) -> bool: + """Extract match into output. - If _pattern_ is not false-y and is contained in _line_, - returns true (and if the _emit_last_ flag is true, - emits the last group of the match if any). Otherwise, - check_pattern does nothing but return false. + If _match_object_ is not false-y, returns true. + If extract flag is true, emits the last group of the match if any. """ - if not pattern: - return False - match_object = pattern.search(line) if not match_object: return False if match_object.lastindex and emit_last: @@ -297,24 +307,6 @@ anticipated by the `{%- block ... %}` directives placed by the theme writer. class SemiliteratePlugin(SimplePlugin): r""" md An extension of the mkdocs-simple-plugin - -### Universal block-comment markdown - -By default, `semiliterate` scans for block-comment markdown `/** md` ... `**/` -in all files with _any_ extension, as it's valid in so many disparate languages. -(As opposed to `simple`, which defaults to searching for such markdown in a -specific list of file types.) - """ - - super_sdict = dict(SimplePlugin.config_scheme) - super_semi_dflt = super_sdict['semiliterate'].default - semi_dflt = [b if 'js' not in b['pattern'] else dict(b, pattern=r'\.') - for b in super_semi_dflt] - altered_config_scheme = dict( - super_sdict, - semiliterate=config_options.Type(list, default=semi_dflt)).items() - - add_param_doc = r""" md ### Additional plugin parameters `semiliterate` adds a couple of new plugin parameters to further tailor its @@ -322,7 +314,7 @@ behavior as compared to `simple`. They are described in this section, with default values in parentheses at the beginning of each entry. {! plugin.py extract: - start: '[*]altered_config_scheme' + start: '[*]super_config_scheme' replace: - ["\\('(.*)',\\s*$", '\1\n'] - ['config_options.Type.*?default=([^\)]*)', ': (\1)'] @@ -334,9 +326,10 @@ terminate: '^\s*\)' stop: '["]{3}' !} """ + super_config_scheme = SimplePlugin.config_scheme config_scheme = ( # Note documentation of each new parameter **follows** the parameter. - *altered_config_scheme, + *super_config_scheme, ('exclude_extensions', config_options.Type(list, default=['.o'])), # Files whose name contains a string in this list will not be @@ -372,25 +365,6 @@ terminate: '^\s*\)' ) def on_config(self, config, **kwargs): - # Since we have extensions in Demiliterate, suppress the semiliterate - # configuration until we handle it ourselves: - semi = self.config['semiliterate'] - self.config['semiliterate'] = [] - new_config = super().on_config(config, **kwargs) - self.config['semiliterate'] = semi - self.semiliterate = [Demiliterate(**item) for item in semi] - self.exclude_extensions = self.config['exclude_extensions'] - dflt_enable = False - if not self.config['copy_standard_markdown']: - self.include_extensions = self.config['include_extensions'] - dflt_enable = True - if self.config['extract_standard_markdown'].get('enable', dflt_enable): - ext_pat = '|'.join(re.escape(s) for s in utils.markdown_extensions) - self.semiliterate.append( - Demiliterate( - pattern=re.compile(f"^(.*(?:{ext_pat}))$"), - destination=r'\1', - **self.config['extract_standard_markdown'])) r""" md ### Adjusting the mkdocs theme @@ -401,13 +375,17 @@ in the generated docs dir to the theme search path. (Note this means that files in the corresponding subdirectory of your project will be copied into the resulting doc site unless their names start with a '.') """ + # Save the include extensions before SimplePlugin modifies them: + self.config['saved_includes'] = self.config['include_extensions'] + new_config = super().on_config(config, **kwargs) cfpath = os.path.dirname(config.config_file_path) self.custom_dir = None for themedir in config['theme'].dirs: common = os.path.commonpath([cfpath, themedir]) if common == cfpath: self.custom_dir = os.path.relpath(themedir, cfpath) - newthemedir = os.path.join(self.build_docs_dir, self.custom_dir) + newthemedir = os.path.join( + self.config['build_docs_dir'], self.custom_dir) utils.log.debug( 'mkdocs-semiliterate: found theme.custom_dir = ' + self.custom_dir @@ -427,17 +405,74 @@ the resulting doc site unless their names start with a '.') + f"from theme directory {self.custom_dir}") files.remove(sources[path]) - def in_extensions(self, file): + def on_pre_build(self, *, config): + """Build documentation directory with files according to settings.""" + semisimple = Semisimple(**self.config) + + # Merge docs + if self.config["merge_docs_dir"]: + semisimple.merge_docs(self.orig_docs_dir) + # Copy all of the valid doc files into build_docs_dir + self.paths = semisimple.build_docs() + + +class Semisimple(Simple): + """Mkdocs Semisimple Plugin""" + def __init__(self, semiliterate, exclude_extensions, saved_includes, + copy_standard_markdown, extract_standard_markdown, + extract_on_copy, **kwargs): + # Since we have extensions in Demiliterate, suppress the semiliterate + # configuration until we handle it ourselves: + super().__init__(semiliterate=[], **kwargs) + self.semiliterate = [Demiliterate(**item) for item in semiliterate] + self.exclude_extensions = exclude_extensions + self.extract_on_copy = extract_on_copy + dflt_enable = False + if not copy_standard_markdown: + self.copy_glob = set(saved_includes) + dflt_enable = True + if extract_standard_markdown.get('enable', dflt_enable): + ext_pat = '|'.join(re.escape(s) for s in utils.markdown_extensions) + self.semiliterate.append( + Demiliterate( + pattern=re.compile(f"^(.*(?:{ext_pat}))$"), + destination=r'\1', + **extract_standard_markdown)) + + def should_copy_file(self, file): if any(ext in file for ext in self.exclude_extensions): return False - return super().in_extensions(file) + return super().should_copy_file(file) - def extract_from(self, from_directory, name, to_directory): + def try_extract(self, from_directory, name, to_directory): if any(ext in name for ext in self.exclude_extensions): return False - if not self.config['extract_on_copy'] and self.in_extensions(name): + if not self.extract_on_copy and self.should_copy_file(name): return False - return super().extract_from(from_directory, name, to_directory) + return super().try_extract(from_directory, name, to_directory) + + # Had to override this because the simple version hardcoded that if a file + # was copied, it could not be extracted. So check carefully for changes in + # simple. Only the lines between # # START and # # END differ. + def build_docs(self) -> list: + """Build the docs directory from workspace files.""" + paths = [] + files = self.get_files() + for file in files: + if not os.path.isfile(file): + continue + from_dir = os.path.dirname(file) + name = os.path.basename(file) + build_prefix = os.path.normpath( + os.path.join(self.build_dir, from_dir)) + + # # START + copied = self.try_copy_file(from_dir, name, build_prefix) + extracted = self.try_extract(from_dir, name, build_prefix) + if (copied or extracted): + paths.append(file) + # # END + return paths class Demiliterate(Semiliterate): @@ -483,7 +518,7 @@ semiliterate.ensurelines Returns True if extraction was successful. """ - to_file = self.filenname_match(from_file) + to_file = self.filename_match(from_file) if not to_file: return False from_file_path = os.path.join(from_directory, from_file) @@ -491,7 +526,9 @@ semiliterate.ensurelines (destination_directory, to_file) = os.path.split(to_file_path) # ADDED try: with open(from_file_path) as original_file: - utils.log.debug(f"mkdocs-semiliterate: Scanning {from_file}...") + utils.log.debug( + f"mkdocs-semiliterate: In {from_directory}, " + + f"scanning {from_file}...") # extraction = StreamExtract( extraction = StreamInclusion( input_stream=original_file, @@ -502,6 +539,9 @@ semiliterate.ensurelines patterns=self.patterns, **kwargs) return extraction.extract() + except (UnicodeDecodeError) as error: + utils.log.info("mkdocs-semiliterate: skipping %s\n %s", + from_file_path, str(error)) except BaseException as error: utils.log.error( f"mkdocs-semiliterate: could not build {from_file_path}:\n " diff --git a/setup.cfg b/setup.cfg index 66d2a0f..42d05ac 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = mkdocs-semiliterate -version = 0.6.0 +version = 0.7.0 description = Extension of mkdocs-simple-plugin adding easy content inclusion long_description = file: README.md long_description_content_type = text/markdown @@ -24,8 +24,8 @@ license = Apache-2.0 [options] packages = mkdocs_semiliterate install_requires = - mkdocs~=1.3.1 - mkdocs-simple-plugin~=1.0 + mkdocs~=1.4 + mkdocs-simple-plugin==2.1.2 [options.entry_points] mkdocs.plugins = diff --git a/tests/fixtures/extract-inclusion/refsite/css/base.css b/tests/fixtures/extract-inclusion/refsite/css/base.css index 25e17a6..3a4c08f 100644 --- a/tests/fixtures/extract-inclusion/refsite/css/base.css +++ b/tests/fixtures/extract-inclusion/refsite/css/base.css @@ -215,7 +215,7 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head -.admonition { +.admonition, details { padding: 15px; margin-bottom: 20px; border: 1px solid transparent; @@ -223,29 +223,33 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head text-align: left; } -.admonition.note { /* csslint allow: adjoining-classes */ - color: #3a87ad; - background-color: #d9edf7; +.admonition.note, details.note { /* csslint allow: adjoining-classes */ + color: #2e6b89; + background-color: #e2f0f7; border-color: #bce8f1; } -.admonition.warning { /* csslint allow: adjoining-classes */ - color: #c09853; - background-color: #fcf8e3; +.admonition.warning, details.warning { /* csslint allow: adjoining-classes */ + color: #7a6032; + background-color: #fffae5; border-color: #fbeed5; } -.admonition.danger { /* csslint allow: adjoining-classes */ - color: #b94a48; - background-color: #f2dede; +.admonition.danger, details.danger { /* csslint allow: adjoining-classes */ + color: #7f3130; + background-color: #fde3e3; border-color: #eed3d7; } -.admonition-title { +.admonition-title, summary { font-weight: bold; text-align: left; } +.admonition>p:last-child, details>p:last-child { + margin-bottom: 0; +} + @media (max-width: 991.98px) { .navbar-collapse.show { /* csslint allow: adjoining-classes */ overflow-y: auto; diff --git a/tests/fixtures/full-inclusion/refsite/css/base.css b/tests/fixtures/full-inclusion/refsite/css/base.css index 25e17a6..3a4c08f 100644 --- a/tests/fixtures/full-inclusion/refsite/css/base.css +++ b/tests/fixtures/full-inclusion/refsite/css/base.css @@ -215,7 +215,7 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head -.admonition { +.admonition, details { padding: 15px; margin-bottom: 20px; border: 1px solid transparent; @@ -223,29 +223,33 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head text-align: left; } -.admonition.note { /* csslint allow: adjoining-classes */ - color: #3a87ad; - background-color: #d9edf7; +.admonition.note, details.note { /* csslint allow: adjoining-classes */ + color: #2e6b89; + background-color: #e2f0f7; border-color: #bce8f1; } -.admonition.warning { /* csslint allow: adjoining-classes */ - color: #c09853; - background-color: #fcf8e3; +.admonition.warning, details.warning { /* csslint allow: adjoining-classes */ + color: #7a6032; + background-color: #fffae5; border-color: #fbeed5; } -.admonition.danger { /* csslint allow: adjoining-classes */ - color: #b94a48; - background-color: #f2dede; +.admonition.danger, details.danger { /* csslint allow: adjoining-classes */ + color: #7f3130; + background-color: #fde3e3; border-color: #eed3d7; } -.admonition-title { +.admonition-title, summary { font-weight: bold; text-align: left; } +.admonition>p:last-child, details>p:last-child { + margin-bottom: 0; +} + @media (max-width: 991.98px) { .navbar-collapse.show { /* csslint allow: adjoining-classes */ overflow-y: auto; diff --git a/tests/fixtures/git-inclusion/refsite/css/base.css b/tests/fixtures/git-inclusion/refsite/css/base.css index 25e17a6..3a4c08f 100644 --- a/tests/fixtures/git-inclusion/refsite/css/base.css +++ b/tests/fixtures/git-inclusion/refsite/css/base.css @@ -215,7 +215,7 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head -.admonition { +.admonition, details { padding: 15px; margin-bottom: 20px; border: 1px solid transparent; @@ -223,29 +223,33 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head text-align: left; } -.admonition.note { /* csslint allow: adjoining-classes */ - color: #3a87ad; - background-color: #d9edf7; +.admonition.note, details.note { /* csslint allow: adjoining-classes */ + color: #2e6b89; + background-color: #e2f0f7; border-color: #bce8f1; } -.admonition.warning { /* csslint allow: adjoining-classes */ - color: #c09853; - background-color: #fcf8e3; +.admonition.warning, details.warning { /* csslint allow: adjoining-classes */ + color: #7a6032; + background-color: #fffae5; border-color: #fbeed5; } -.admonition.danger { /* csslint allow: adjoining-classes */ - color: #b94a48; - background-color: #f2dede; +.admonition.danger, details.danger { /* csslint allow: adjoining-classes */ + color: #7f3130; + background-color: #fde3e3; border-color: #eed3d7; } -.admonition-title { +.admonition-title, summary { font-weight: bold; text-align: left; } +.admonition>p:last-child, details>p:last-child { + margin-bottom: 0; +} + @media (max-width: 991.98px) { .navbar-collapse.show { /* csslint allow: adjoining-classes */ overflow-y: auto; diff --git a/tests/fixtures/no-extract-inclusion/refsite/css/base.css b/tests/fixtures/no-extract-inclusion/refsite/css/base.css index 25e17a6..3a4c08f 100644 --- a/tests/fixtures/no-extract-inclusion/refsite/css/base.css +++ b/tests/fixtures/no-extract-inclusion/refsite/css/base.css @@ -215,7 +215,7 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head -.admonition { +.admonition, details { padding: 15px; margin-bottom: 20px; border: 1px solid transparent; @@ -223,29 +223,33 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head text-align: left; } -.admonition.note { /* csslint allow: adjoining-classes */ - color: #3a87ad; - background-color: #d9edf7; +.admonition.note, details.note { /* csslint allow: adjoining-classes */ + color: #2e6b89; + background-color: #e2f0f7; border-color: #bce8f1; } -.admonition.warning { /* csslint allow: adjoining-classes */ - color: #c09853; - background-color: #fcf8e3; +.admonition.warning, details.warning { /* csslint allow: adjoining-classes */ + color: #7a6032; + background-color: #fffae5; border-color: #fbeed5; } -.admonition.danger { /* csslint allow: adjoining-classes */ - color: #b94a48; - background-color: #f2dede; +.admonition.danger, details.danger { /* csslint allow: adjoining-classes */ + color: #7f3130; + background-color: #fde3e3; border-color: #eed3d7; } -.admonition-title { +.admonition-title, summary { font-weight: bold; text-align: left; } +.admonition>p:last-child, details>p:last-child { + margin-bottom: 0; +} + @media (max-width: 991.98px) { .navbar-collapse.show { /* csslint allow: adjoining-classes */ overflow-y: auto; diff --git a/tests/fixtures/quoted-filename/refsite/css/base.css b/tests/fixtures/quoted-filename/refsite/css/base.css index 25e17a6..3a4c08f 100644 --- a/tests/fixtures/quoted-filename/refsite/css/base.css +++ b/tests/fixtures/quoted-filename/refsite/css/base.css @@ -215,7 +215,7 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head -.admonition { +.admonition, details { padding: 15px; margin-bottom: 20px; border: 1px solid transparent; @@ -223,29 +223,33 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head text-align: left; } -.admonition.note { /* csslint allow: adjoining-classes */ - color: #3a87ad; - background-color: #d9edf7; +.admonition.note, details.note { /* csslint allow: adjoining-classes */ + color: #2e6b89; + background-color: #e2f0f7; border-color: #bce8f1; } -.admonition.warning { /* csslint allow: adjoining-classes */ - color: #c09853; - background-color: #fcf8e3; +.admonition.warning, details.warning { /* csslint allow: adjoining-classes */ + color: #7a6032; + background-color: #fffae5; border-color: #fbeed5; } -.admonition.danger { /* csslint allow: adjoining-classes */ - color: #b94a48; - background-color: #f2dede; +.admonition.danger, details.danger { /* csslint allow: adjoining-classes */ + color: #7f3130; + background-color: #fde3e3; border-color: #eed3d7; } -.admonition-title { +.admonition-title, summary { font-weight: bold; text-align: left; } +.admonition>p:last-child, details>p:last-child { + margin-bottom: 0; +} + @media (max-width: 991.98px) { .navbar-collapse.show { /* csslint allow: adjoining-classes */ overflow-y: auto; diff --git a/tests/fixtures/recursive-inclusion/refsite/css/base.css b/tests/fixtures/recursive-inclusion/refsite/css/base.css index 25e17a6..3a4c08f 100644 --- a/tests/fixtures/recursive-inclusion/refsite/css/base.css +++ b/tests/fixtures/recursive-inclusion/refsite/css/base.css @@ -215,7 +215,7 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head -.admonition { +.admonition, details { padding: 15px; margin-bottom: 20px; border: 1px solid transparent; @@ -223,29 +223,33 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head text-align: left; } -.admonition.note { /* csslint allow: adjoining-classes */ - color: #3a87ad; - background-color: #d9edf7; +.admonition.note, details.note { /* csslint allow: adjoining-classes */ + color: #2e6b89; + background-color: #e2f0f7; border-color: #bce8f1; } -.admonition.warning { /* csslint allow: adjoining-classes */ - color: #c09853; - background-color: #fcf8e3; +.admonition.warning, details.warning { /* csslint allow: adjoining-classes */ + color: #7a6032; + background-color: #fffae5; border-color: #fbeed5; } -.admonition.danger { /* csslint allow: adjoining-classes */ - color: #b94a48; - background-color: #f2dede; +.admonition.danger, details.danger { /* csslint allow: adjoining-classes */ + color: #7f3130; + background-color: #fde3e3; border-color: #eed3d7; } -.admonition-title { +.admonition-title, summary { font-weight: bold; text-align: left; } +.admonition>p:last-child, details>p:last-child { + margin-bottom: 0; +} + @media (max-width: 991.98px) { .navbar-collapse.show { /* csslint allow: adjoining-classes */ overflow-y: auto; diff --git a/tests/fixtures/sibling-destination/refsite/css/base.css b/tests/fixtures/sibling-destination/refsite/css/base.css index 25e17a6..3a4c08f 100644 --- a/tests/fixtures/sibling-destination/refsite/css/base.css +++ b/tests/fixtures/sibling-destination/refsite/css/base.css @@ -215,7 +215,7 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head -.admonition { +.admonition, details { padding: 15px; margin-bottom: 20px; border: 1px solid transparent; @@ -223,29 +223,33 @@ h1:hover .headerlink, h2:hover .headerlink, h3:hover .headerlink, h4:hover .head text-align: left; } -.admonition.note { /* csslint allow: adjoining-classes */ - color: #3a87ad; - background-color: #d9edf7; +.admonition.note, details.note { /* csslint allow: adjoining-classes */ + color: #2e6b89; + background-color: #e2f0f7; border-color: #bce8f1; } -.admonition.warning { /* csslint allow: adjoining-classes */ - color: #c09853; - background-color: #fcf8e3; +.admonition.warning, details.warning { /* csslint allow: adjoining-classes */ + color: #7a6032; + background-color: #fffae5; border-color: #fbeed5; } -.admonition.danger { /* csslint allow: adjoining-classes */ - color: #b94a48; - background-color: #f2dede; +.admonition.danger, details.danger { /* csslint allow: adjoining-classes */ + color: #7f3130; + background-color: #fde3e3; border-color: #eed3d7; } -.admonition-title { +.admonition-title, summary { font-weight: bold; text-align: left; } +.admonition>p:last-child, details>p:last-child { + margin-bottom: 0; +} + @media (max-width: 991.98px) { .navbar-collapse.show { /* csslint allow: adjoining-classes */ overflow-y: auto; diff --git a/tests/fixtures/theme-modification/mkdocs.yml b/tests/fixtures/theme-modification/mkdocs.yml index 29075c4..cd8949d 100644 --- a/tests/fixtures/theme-modification/mkdocs.yml +++ b/tests/fixtures/theme-modification/mkdocs.yml @@ -5,7 +5,8 @@ theme: custom_dir: doc_theme/ plugins: - semiliterate: - ignore_folders: [refsite, snippet] + ignore_folders: [refsite] + ignore_hidden: false merge_docs_dir: false include_extensions: [] semiliterate: