diff --git a/docs/configuration/generating-pdf-documents.md b/docs/configuration/generating-pdf-documents.md index 889b9f1..57136e4 100644 --- a/docs/configuration/generating-pdf-documents.md +++ b/docs/configuration/generating-pdf-documents.md @@ -221,6 +221,8 @@ plugins: attributes: !!python/name:mkdocs_exporter.formats.pdf.buttons.download.attributes ``` +
+ ### Combining pages into a single PDF document In *MkDocs Exporter*, the aggregator feature allows you to consolidate multiple individual PDF documents into a single cohesive PDF file. @@ -248,26 +250,5 @@ plugins: pdf: aggregator: enabled: true - covers: all - output: combined.pdf -``` - -#### Configuring cover pages - -In your `mkdocs.yml` configuration file, you can specify how cover pages are handled during the aggregation process using the `covers` parameter: - -```yaml -plugins: - - exporter: - formats: - pdf: - aggregator: - enabled: true - covers: all + output: documentation.pdf ``` - -You can define how cover pages from individual PDFs should be handled using one of the following modes: - -- `none`: Cover pages will be skipped in the final combined document. -- `all` (*default*): Cover pages will be included as-is from each individual PDF. -- `limits`: Only the front cover of the first page and the back cover of the last page will be included in the combined document. diff --git a/docs/getting-started.md b/docs/getting-started.md index 4ae6de0..c5dee31 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -13,7 +13,7 @@ hide: ## Examples -- [__Read__ this documentation in the PDF format](./combined.pdf) +- [__Read__ this documentation in the PDF format](../documentation.pdf) - [__View__ this page in the PDF format](./index.pdf) ## Prerequisites diff --git a/mkdocs.yml b/mkdocs.yml index 30c3507..4eb19fa 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -46,6 +46,8 @@ extra: link: https://pypi.org/project/mkdocs-exporter plugins: + - privacy: + log_level: warn - mkdocstrings: handlers: python: @@ -85,7 +87,6 @@ plugins: - resources/stylesheets/pdf.scss covers: front: resources/templates/covers/front.html.j2 - back: resources/templates/covers/back.html.j2 browser: debug: false headless: true diff --git a/mkdocs_exporter/config.py b/mkdocs_exporter/config.py index 4966182..9b3a95d 100644 --- a/mkdocs_exporter/config.py +++ b/mkdocs_exporter/config.py @@ -32,6 +32,7 @@ class LoggingConfig(BaseConfig): """The logging configuration.""" level = c.Choice(['debug', 'info', 'warning', 'error', 'critical'], default='info') + """The log level.""" class Config(BaseConfig): diff --git a/mkdocs_exporter/formats/pdf/config.py b/mkdocs_exporter/formats/pdf/config.py index 3f00e2c..5c0c400 100644 --- a/mkdocs_exporter/formats/pdf/config.py +++ b/mkdocs_exporter/formats/pdf/config.py @@ -33,9 +33,6 @@ class AggregatorConfig(BaseConfig): output = c.Type(str, default='combined.pdf') """The aggregated PDF document output file path.""" - covers = c.Choice(['none', 'all', 'limits'], default='all') - """The behaviour of cover pages.""" - metadata = c.Type(dict, default={}) """Some metadata to append to the PDF document.""" diff --git a/mkdocs_exporter/formats/pdf/plugin.py b/mkdocs_exporter/formats/pdf/plugin.py index cd16be6..0ec422f 100644 --- a/mkdocs_exporter/formats/pdf/plugin.py +++ b/mkdocs_exporter/formats/pdf/plugin.py @@ -62,19 +62,11 @@ def on_page_markdown(self, markdown: str, page: Page, config: Config, **kwargs) content = markdown covers = {**self.config.covers, **{k: os.path.join(os.path.dirname(config['config_file_path']), v) for k, v in page.meta.get('covers', {}).items()}} - page.formats['pdf']['covers'] = { - 'front': False, - 'back': False - } if covers.get('front'): - page.formats['pdf']['covers']['front'] = True - with open(covers['front'], 'r', encoding='utf-8') as file: content = self.renderer.cover(file.read()) + content if covers.get('back'): - page.formats['pdf']['covers']['back'] = True - with open(covers['back'], 'r', encoding='utf-8') as file: content = content + self.renderer.cover(file.read())