Skip to main content
# MDRec : Markdown Recorder from python

[![Current version on PyPI](http://img.shields.io/pypi/v/mdrec.svg)](PyPI)
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)

MDRec creates markdown file easily from python object.
You can also convert this to html file at once.


## Installation

```bash
pip install mdrec
```

## Example

Here is example code, output result and raw_file respectively.

### Code

```python
from mdrec import MDRec

save_file = "./out/test_txt.md"
# set markdown file. (You may also try not to set this option.)
r = MDRec(save_file=save_file)

# suppoort header. write "#### testtest\n\n" in designated save_file.
r.rec("testtest", h=4)

# plain txt
r.rec("this is example below")

# express itemization via Iterable object
r.rec([1,2,3])

# draw vertical line
r.line()

# support ja
r.rec(["あ", "い", "う", {"え" : "お"}])

# you should draw a vertical line explicitly
r.line()

# support nested list, dict or Iterable.
r.rec([1,[1,2],[2,[3],4], [{"a": 100, "b": 234}], {"c" : [3,4,5]}])

## support quote
r.increase_quote_level()
## If you set raw option to be False, suppress markdown output in jupyter notebook.
r.rec("testtest", h=2, raw=False)

r.increase_quote_level()
r.rec(["z", 'x'])

r.reset_quote_level()

from pandas import DataFrame
# support DataFrame or Series ((NOT support list of list)
df = DataFrame([[12, 2, 4, 3], [3, 3, 3, 4]], columns=list("abcd"), index=["AB", "BB"])

# display table with title
r.rec(df, title="test", h=3)

# set link. support both url and local file path.
r.link(src="./test01.png", title="test", text="sample")

# image link with markdown syntax. To display image in jupyter notebook syncronously, set copy_sync=True
r.img(src="./test01.png", title="test", text="sample", copy_sync=True)

# export markdown file to html via github API. (You can set your username and password in ~/.grip/settings.py.)
r.to_html()
```

### Output

`<start>`

#### testtest

this is example below

- 1
- 2
- 3

---

- あ
- い
- う
- え: お

---

- 1
- - 1
- 2
- - 2
- - 3
- 4
- - a: 100
b: 234
- c:
- 3
- 4
- 5

> ## testtest
>
>> - z
>> - x
>>
### test
| | a | b | c | d |
|---|----:|----:|----:|----:|
|AB | 12| 2| 4| 3|
|BB | 3| 3| 3| 4|


[sample](../test01.png "test")

![sample](img/test01.png "test")



`<end>`

### Raw

```markdown
#### testtest

this is example below

- 1
- 2
- 3

---

- あ
- い
- う
- え: お

---

- 1
- - 1
- 2
- - 2
- - 3
- 4
- - a: 100
b: 234
- c:
- 3
- 4
- 5

> ## testtest
>
>> - z
>> - x
>>
### test
| | a | b | c | d |
|---|----:|----:|----:|----:|
|AB | 12| 2| 4| 3|
|BB | 3| 3| 3| 4|


[sample](../test01.png "test")

![sample](img/test01.png "test")
```

## Usage

+ By default, results are also displayed in jupyter notebook, so if you switch off the option, let `r.rec(obj, raw=False)`.

## Configuration

+ If you use `MDRec.to_html`, note that this call [Grip](https://github.com/joeyespo/grip) and github API implicitly. To set github username and password, see the link, https://github.com/joeyespo/grip#configuration.


Metadata

Release files for mdrec 0.1.1

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

Source distribution (sdist)

Source distribution for mdrec 0.1.1
File Size Uploaded Provenance Actions
mdrec-0.1.1.tar.gz 4.6 kB Without provenance Details for mdrec-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 12.2 kB

Release files / mdrec-0.1.1.tar.gz

Download URL mdrec-0.1.1.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3875091cb54c44755eb2f610a3248581d903d05e528f3ac5e500e208b245a8c7
BLAKE2b-256 checksum
How to use checksums
27c5a81856b5d0f20b0f7f2c7fe7d6661c05e137e2d054fd19207f736a3f7b8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / mdrec-0.1.1-py3-none-any.whl

Download URL mdrec-0.1.1-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
689eb4dcb95bbac655f7fdf3b9a85f12043379f947b548497cece4081e0cb7a4
BLAKE2b-256 checksum
How to use checksums
9304f818508dafd50cf6c0a9f74f8c36e7e16c67f8d66d94b2810acc9f643ce8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for mdrec 0.1.1

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

0.1.1 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