Skip to main content

minsert

Insert dynamic content in markdown, without using a separate template file.

Tests Code Quality PyPI - Python Version codecov

Motivation

Inspired by jinja.

Your actual markdown file is the template file itself. Just make a block of content just by using comments, which indicate the start and end of the block.

This is really great for making a dynamic GitHub README. No hassle of creating a separate template file. Using a simple python script and GitHub Actions, you can automatically update the contents of the markdown file.

Installation

pip install minsert

Syntax

Using minsert is easy. Just write normal markdown. The start and end of named blocks are marked by special comments.

Start a block named my_block

<!-- start my_block -->

End a block

<!-- end -->

You must end the current block before starting a new one.

Usage

For example you have a markdown file test.md like this.

hello
<!-- start thing1 -->
<!-- end -->
what is happening
<!-- start thing2 -->
<!-- end -->
Bye!

Create a simple script update.py for updating the markdown file.

# update.py

from minsert import MarkdownFile

file = MarkdownFile("test.md")
things = {
    "thing1": "hi hello",
    "thing2": "ping pong",
}
file.insert(things)

The markdown file gets updated with the value of the blocks.

hello
<!-- start thing1 -->
hi hello
<!-- end -->
what is happening
<!-- start thing2 -->
ping pong
<!-- end -->
Bye!

Now try running update.py after changing the values in the things dictionary. You will see that minsert will neatly update the test.md without fail.

Metadata

Release files for minsert 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for minsert 0.1.0
File Size Uploaded Provenance Actions
minsert-0.1.0.tar.gz 4.4 kB Without provenance Details for minsert-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for minsert 0.1.0
File Interpreter ABI Platform Actions
minsert-0.1.0-py3-none-any.whl Python 3 none any Details for minsert-0.1.0-py3-none-any.whl

Total release size: 8.6 kB

Release files / minsert-0.1.0.tar.gz

Download URL minsert-0.1.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bc172bb3991c2dc53f6970a2f779d9827c6c382db719ac6901a4c97524475dc9
BLAKE2b-256 checksum
How to use checksums
d353f6820469d53abe04fa8797148a4f84966e50eac8c394f774db2519376954
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.9.5 Linux/5.8.0-55-generic

Release files / minsert-0.1.0-py3-none-any.whl

Download URL minsert-0.1.0-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f69899cac5e4180695be0ecef049f3b6604716896e5fa1286888ea5feddfd093
BLAKE2b-256 checksum
How to use checksums
b8be9eb54eded6e4ba73f633296ea7078dfdc59c41440763b74aa7ad4592a7a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.6 CPython/3.9.5 Linux/5.8.0-55-generic

Security for minsert 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page