Skip to main content

mkdocs-import-statement-plugin

This plugin is for MkDocs to add capability of @import "file" statement to directly insert various files into a page.

Supported file types

As image file type, following extensions are supported

Extension File type Behavior
.jpeg JPEG Image
.jpg ^ ^
.gif Graphics Interchange Format ^
.png Portable Network Graphics ^
.apng Animated Portable Network Graphics ^
.svg Scalable Vector Graphics ^
.bmp Windows bitmap ^

Following extensions are also supported.

Extension File type Behavior
.csv Comma-Separated Values Table
.js JavaScript JavaScript
.md Markdown Markdown
.html HTML Text
.htm ^ ^
.mermaid Mermaid Comment
.dot DOT ^
.puml PlantUML ^
.pu ^ ^

Installation

Install the plugin using pip:

pip install mkdocs-import-statement-plugin

Next, add the following lines to your mkdocs.yml:

plugins:
  - search
  - import-statement

If you have no plugins entry in your config file yet, you'll likely also want to add the search plugin. MkDocs enables it by default if there is no plugins entry set.

Usage

In your markdown documents you can describe as following.

@import "file"

When you use MkDocs, this plugin will replace these import statements appropriately depending on the extension.

Image file

The import statement is replaced as following.

![](file)

If there are {} options after the import statement, that statement will be replaced with a <img> tag.

For example,

@import "file" {width="640" height="480"}

is converted to as follwoing.

<img src="file" width="640" height="480">

Where the image file path is relative to the markdown file.

Table file

The import statement is replaced with a Markdown table that expands the contents of the specified file.

For example, when the following CSV file is as following.

A1,B1,C1
A2,B2,C2
A3,B3,C3

This replaced to as following.

| A1 | B1 | C1 |
| :- | :- | :- |
| A2 | B2 | C2 |
| A3 | B3 | C3 |

JavaScript file

The import statement is replaced with <script> tag like as following.

<script type="text/javascript" src="file"></script>

Markdown file

The import statement is replaced with the contents of the specified file and the replacement is recursively processed.

Text file

The import statement is replaced with the contents of the specified file.

Comment file

The import statement is replaced by comment blocks of the contents of the specified file.

Metadata

Release files for mkdocs-import-statement-plugin 23.1.4

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

Source distribution (sdist)

Source distribution for mkdocs-import-statement-plugin 23.1.4
File Size Uploaded Provenance
mkdocs-import-statement-plugin-23.1.4.tar.gz 6.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mkdocs-import-statement-plugin 23.1.4
File Interpreter ABI Platform
mkdocs_import_statement_plugin-23.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 12.9 kB

Release files / mkdocs-import-statement-plugin-23.1.4.tar.gz

Download URL mkdocs-import-statement-plugin-23.1.4.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
16f49221625556f363804f40c84f053dcd971662b30b32751a56b0b0ed2e7d27
BLAKE2b-256 checksum
How to use checksums
3839928662c2373c8e0d7c535ba750a3da7e7cdb493392e11f162bbc84b01512
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Release files / mkdocs_import_statement_plugin-23.1.4-py3-none-any.whl

Download URL mkdocs_import_statement_plugin-23.1.4-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76f3b0c6ded3b3aa1f148e9c239e78789019512a8d599a22f96e083ecdcf8a87
BLAKE2b-256 checksum
How to use checksums
84d0e20e6815d308d4b3aee2385f2cc63f975458741aeb06772bd6acb05e23e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.8

Security for mkdocs-import-statement-plugin 23.1.4

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.

Release history Release notifications | RSS feed

This release

23.1.4 This release

2 release files No provenance

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