Skip to main content

Embed markdown files into html

Project description

embedmd - embed Markdown into Markdown or HTML

embedmd is a command line tool to embed Markdown within other documents. Right now you can embed Markdown within other Markdown documents as well as embed markdown within HTML documents.

This tool utilizes the Python-Markdown package.

Installation

pip install embedmd

or

pip install git+https://github.com/kylepollina/embedmd

Embed Markdown within HTML

Place this text in your HTML file where you want to embed Markdown:

<#INCLUDE filename.md>

Where filename.md is pointing to the Markdown file you wish to embed in that spot of the HTML file. Then, run the tool from the command line.

embedmd input.html

Embed Markdown within other Markdown

Place this text in your Markdown file where you want to embed markdown:

[#INCLUDE filename.md]

Where filename.md is pointing to the Markdown file you wish to embed in that spot of the HTML file. Then, run the tool from the command line.

embedmd input.md

Example

Say we have this HTML file...

<!-- template.html -->

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
  </head>
  <body>
    <div id="container">

      <#INCLUDE test1.md>

      <#INCLUDE test2.md>

    </div>
  </body>
</html>

... and we want to embed these Markdown documents within.

# test1.md

Hello world, this is brought to you using [embedmd](https://github.com/kylepollina/embedmd)
# test2.md

| date       | species
| :-----     | :-------
| 2020-07-21 | Red-winged blackbird
| 2020-07-21 | Eurasian Tree sparrow

#include "test3.md"
# test3.md
Wort wort wort

Running the embedmd command:

embedmd template.html

will print out

<!-- template.html -->

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
  </head>
  <body>
    <div id="container">

      <h1>test1.md</h1>
<p>Hello world, this is brought to you using <a href="https://github.com/kylepollina/embedmd">embedmd</a></p>

      <h1>test2.md</h1>
<table>
<thead>
<tr>
<th align="left">date</th>
<th align="left">species</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">2020-07-21</td>
<td align="left">Red-winged blackbird</td>
</tr>
<tr>
<td align="left">2020-07-21</td>
<td align="left">Eurasian Tree sparrow</td>
</tr>
</tbody>
</table>
<h1>test3.md</h1>
<p>Wort wort wort</p>

    </div>
  </body>
</html>

example output

License

MIT License Copyright Kyle Pollina

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

embedmd-0.8.2.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

embedmd-0.8.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file embedmd-0.8.2.tar.gz.

File metadata

  • Download URL: embedmd-0.8.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for embedmd-0.8.2.tar.gz
Algorithm Hash digest
SHA256 901c124f83f2a923d7ffdb830117b6ca197b92291970904e1a4bb7858e513077
MD5 1d9071e7c4b271d127808005ddf9673e
BLAKE2b-256 44754eaa55055c06a3d8b859bca560221e9c6999d1d874e00b8cf95bfb23a13a

See more details on using hashes here.

File details

Details for the file embedmd-0.8.2-py3-none-any.whl.

File metadata

  • Download URL: embedmd-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.1

File hashes

Hashes for embedmd-0.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ae2391310c27eae762de882d3d11b24e9c090eaab141e624349e6a3c2963fdde
MD5 b117bd6dd74dd5e2d7aa1f64a4985bce
BLAKE2b-256 32eb9967b46b0c9a5901e2fe57924a2a1baefb8d33cfb494b09dfe0560b39aac

See more details on using hashes here.

Supported by

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