Skip to main content

Squish multiple Pandoc-flavored Markdown files into one super squished document.

Project description

squishie

pipeline status coverage report latest release pre-commit cici enabled code style: prettier

Squish multiple Pandoc-flavored Markdown files into one super squished document.

Installation

python3 -m pip install squishie

Usage

Create a directory with your Markdown files:

$ tree
.
├── doc1.md
└── doc2.md

0 directories, 2 files

Each Markdown file should have Pandoc-compatible front matter. For example, doc1.md has the following contents:

# doc1.md
---
title: Doc 1
---
This is some text.

Add a squishie document file to the directory:

# config.yaml
title: My squished document
version: "1.2.3"

sections:
  - file: doc1.md
  - file: doc2.md

Your directory should now look like this:

$ tree
.
├── squishie.yaml
├── doc1.md
└── doc2.md

0 directories, 2 files

Run squishie with the -c/--config option to render the final document:

squishie -c squishie.yaml
$ squishie -c squishie.yaml
---
title: My squished document
version: 1.2.3
---

# Doc 1

This is some text.

# Doc 2

This is different text.

Add the -o/--output option to write the output to a file:

squishie -c squishie.yaml -o my-squished-document.md

It is also possible to add subsections:

sections:
  # ...
  - title: Subsection
    sections:
      - file: doc3.md

      - title: Subsubsection
        sections:
          - file: doc4.md

The header level of a document is automatically adjusted based on the document's position in the overall section tree.

Page and section titles

A title can be added to a page or section with the title keyword:

sections:
  - file: doc1.md
    title: My Title

For each header, an anchor and attribute is also added. Pandoc header_attributes or attributes must be enabled. The following Markdown is generated:

# [My Title](#my-title) {#my-title}

The generated anchors can be customized with the anchor keyword:

sections:
  - file: doc1.md
    title: My Title
    anchor: different-anchor

This will produce the following markdown:

# [My Title](#different-anchor) {#different-anchor}

squishie automatically adds the header anchor as an attribute, but you can add additional attributes with the attributes keyword:

sections:
  - file: doc1.md
    title: My Title
    attributes: .bg-blue .text-white

This produces the following markdown:

# [My Title](#my-title) {#my-title .bg-blue .text-white}

If a page includes a title that you don't want to be shown, set show_title to false to remove it from the output:

sections:
  - file: doc1.md
    show_title: false

License

Copyright 2025 UL Research Institutes.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

squishie-0.5.1.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

squishie-0.5.1-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

File details

Details for the file squishie-0.5.1.tar.gz.

File metadata

  • Download URL: squishie-0.5.1.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for squishie-0.5.1.tar.gz
Algorithm Hash digest
SHA256 958b4677c9dbc40bc2ca6bec2853c78383eaee81de99bb6ab02cca99bb5aeccf
MD5 6fa4c9315f6a4400b0c2263e817698c2
BLAKE2b-256 86170a2b3e9ceeae56e2701a0a6540968ea91727cd28644dcf40e1618a7b4a88

See more details on using hashes here.

File details

Details for the file squishie-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: squishie-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 11.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for squishie-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 321673401801206fbfc1f778d745a16b4e93f04e5090859e81f27d3ed5df4bc0
MD5 a4408eb3bb7ac90ded2d19e85e1ff8f9
BLAKE2b-256 4161b2725c1d8de779aa0f9961474b07ea953b0516ba0059e1fa018e0fa0a398

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page