Import python code in markdown as module
Project description
markmodule
Import python from markdown files.
Markdown is a hammer, everything is a nail
You can use markdown:
- as a place to put module code, markmodule, this library
The do-everything-with-markdown ecosystem is surprisingly robust.
- as a Makefile alternative, mask
- as a place to put scripts, eg python's markdown-exec, or ruby's markdown_exec
- as a place to put unit tests, pytest-markdown-docs, pytest-codeblocks, and pytest-markdown
- as a string template, proof-of-concept gist
Usage
In a file named hello_module.md
m define a function. I'm escaping the fence, use a real three tick fence.
Here is a function
``(`)python
def some_function(args: str) -> str:
"""This is a function that does something."""
return "Hello World" + args
``(`)
And some more documentation
Import. Your IDE will not recognize the module, but it will work at runtime.
import markmodule
markmodule.import_md("hello_module.md")
import hello_module
print(hello_module.some_function("yo!"))
Change Log
- 0.1.0 - Basic idea.
- 0.2.0 - Updates to readme
Documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
markmodule-0.2.0.tar.gz
(4.6 kB
view hashes)
Built Distribution
Close
Hashes for markmodule-0.2.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1470bbe969f2e20e2874a6c821f7a2c13909549a24cb93d0a1a6da851223628c |
|
MD5 | f8c5538ee8c201bd75be4a3b0dae71f2 |
|
BLAKE2b-256 | d51f97a240cef5a1ba4a73427a54e653d23adae7e21219e1674e800bbcf64fc0 |