mdlog 0.1.1
~ Markdown Logging ~
License: Apache2.0

# mdlog
Markdown + HTML Logging
* [x] Log outputs and results directly to files in mark-down or mark-up (html/xml) format.
* [x] Generate on-the-fly reports, ready for presentation.

# Install

`pip install mdlog`

# Usage
* Visit Mark-Down [examples](https://github.com/Nelson-iitp/mdlog/tree/main/examples) on github
* Visit [Mark-Down Overview](https://daringfireball.net/projects/markdown/syntax)

# Sample

___

#### Start Of Sample Log File

___


### How to log?

try **redirecting** from std-out

```
Random Array: [33 67 60 40  1 42 25]
=-=-=-=-==-=-=-=-=
DICT: <class 'mdlog.md.LOG'>
=-=-=-=-==-=-=-=-=
log_dir		:my_logs
log_file		:log.md
log_path		:my_logs\log.md
uri_title_start		:(
uri_title_end		:)
iomode		:w
esc		:False
do_esc		:False
write		:<bound method LOG.write_no_esc of <mdlog.md.LOG object at 0x000001BE7A397F40>>
f		:<_io.TextIOWrapper name='my_logs\\log.md' mode='w' encoding='cp1252'>
rdr_as_code		:True
xf		:<ipykernel.iostream.OutStream object at 0x000001BE79F43580>
=-=-=-=-==-=-=-=-=

```

### Basic Logging

#### write lines...

hello world, for google-home page [(click-here)](https://www.google.com (google-homepage))  bye world ! 

#### write horizontal rule...

___

#### write text blocks...

no-escaping: *Hello world* text

with-escaping \*Hello world\* text

#### write quoted blocks...

>no-escaping: *Hello world* quote

>with-escaping \*Hello world\* quote

#### write code blocks...

```
import mdlog.md.LOG as LOG
print(LOG)
```

#### write controlled-blocks...

write data as it is produced, remember to close blocks when finished! 

some text `goes` here 

>some quotes `goes` here 

```
some code goes here 
```

### Lists

lists can be ordered or unordered or even a hybrid of nested lists 

#### unordered list

* item-1
* item-2
* item-3
* item-4
* item-5
* item-6
* item-7
* item-8
* item-9

#### ordered list

1. 1
1. 2
1. 3
1. 4
1. 5
1. 6
1. 7
1. 8
1. 9


#### 2-level nested list 

ordering of both list can be defined using 'inner_order' and 'outer_order' 

* 0
	1. 1
	1. 2
	1. 3


* 1
	1. 1
	1. 2
	1. 3
	1. 4


* 2
	1. 1


* 3
	1. 1
	1. 2
	1. 3
	1. 4


* 4
	1. 1
	1. 2
	1. 3




#### 2-level nested list from dict

* 1
	1. A
	1. AA

* 2
	1. B

* 3
	1. C



#### Controlled-Lists

instead of adding all the items to a list at once, we may want to add gradually as the data is produced by program this may be usefull for long iterations 

1. item-1
1. item-2
	* item-3
	* item-4
		1. item-5
		1. item-6
	* item-7
	* item-8
		* item-5
		* item-6
	* item-9
1. item-10
1. item-11

### Tables

```
header: [0 1 2 3 4 5 6 7 8 9]
table-data: [[0.15745417 0.60228589 0.20312146 0.79208332 0.44544432 0.94427653
  0.60528485 0.5716133  0.23192585 0.94492984]
 [0.03366903 0.77235639 0.70997255 0.53669765 0.31246849 0.82603627
  0.73131727 0.39977558 0.9708004  0.88898959]
 [0.07600237 0.72963613 0.06301035 0.11824113 0.46420843 0.58475499
  0.3293285  0.17923422 0.47911624 0.61935011]
 [0.4032592  0.85897809 0.05689852 0.92495456 0.9406846  0.06045886
  0.53106509 0.38130727 0.81226556 0.67451416]
 [0.77213756 0.92343502 0.0264955  0.84196636 0.1588999  0.05682337
  0.28115802 0.30384316 0.55067915 0.42432684]]
```

#### Display same table using 4 different functions

##### row-table

|0|1|2|3|4|5|6|7|8|9|
|------:|------:|------:|------:|------:|------:|------:|------:|------:|------:|
|0.1574541650401502|0.6022858922585795|0.20312146254252583|0.7920833222568394|0.44544431852514177|0.9442765325113265|0.6052848546091829|0.5716133018748567|0.2319258530229218|0.9449298413383158|
|0.0336690314226592|0.7723563929297459|0.7099725471843411|0.5366976453819621|0.3124684937098925|0.826036269893938|0.7313172664632944|0.39977557994187707|0.9708004036606988|0.8889895862500321|
|0.07600236782204017|0.7296361261603651|0.06301035222060924|0.11824113167977235|0.46420842768262205|0.584754986450429|0.32932850247288326|0.17923422491890417|0.47911624291921606|0.6193501077351342|
|0.403259204645088|0.8589780944587944|0.05689851858069883|0.924954558581016|0.9406846016980752|0.060458855450524984|0.5310650929933902|0.3813072675045661|0.8122655624983939|0.6745141649744668|
|0.772137560330817|0.9234350237531648|0.026495498450750832|0.8419663625873759|0.15889989922432324|0.05682336740846916|0.2811580179446488|0.3038431568827379|0.550679151291298|0.4243268350279368|

##### multi-row-table

|0|1|2|3|4|5|6|7|8|9|
|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|
|0.1574541650401502|0.6022858922585795|0.20312146254252583|0.7920833222568394|0.44544431852514177|0.9442765325113265|0.6052848546091829|0.5716133018748567|0.2319258530229218|0.9449298413383158|
|0.0336690314226592|0.7723563929297459|0.7099725471843411|0.5366976453819621|0.3124684937098925|0.826036269893938|0.7313172664632944|0.39977557994187707|0.9708004036606988|0.8889895862500321|
|0.07600236782204017|0.7296361261603651|0.06301035222060924|0.11824113167977235|0.46420842768262205|0.584754986450429|0.32932850247288326|0.17923422491890417|0.47911624291921606|0.6193501077351342|
|0.403259204645088|0.8589780944587944|0.05689851858069883|0.924954558581016|0.9406846016980752|0.060458855450524984|0.5310650929933902|0.3813072675045661|0.8122655624983939|0.6745141649744668|
|0.772137560330817|0.9234350237531648|0.026495498450750832|0.8419663625873759|0.15889989922432324|0.05682336740846916|0.2811580179446488|0.3038431568827379|0.550679151291298|0.4243268350279368|

##### col-table

|0|1|2|3|4|5|6|7|8|9|
|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|
|0.1574541650401502|0.6022858922585795|0.20312146254252583|0.7920833222568394|0.44544431852514177|0.9442765325113265|0.6052848546091829|0.5716133018748567|0.2319258530229218|0.9449298413383158||
|0.0336690314226592|0.7723563929297459|0.7099725471843411|0.5366976453819621|0.3124684937098925|0.826036269893938|0.7313172664632944|0.39977557994187707|0.9708004036606988|0.8889895862500321||
|0.07600236782204017|0.7296361261603651|0.06301035222060924|0.11824113167977235|0.46420842768262205|0.584754986450429|0.32932850247288326|0.17923422491890417|0.47911624291921606|0.6193501077351342||
|0.403259204645088|0.8589780944587944|0.05689851858069883|0.924954558581016|0.9406846016980752|0.060458855450524984|0.5310650929933902|0.3813072675045661|0.8122655624983939|0.6745141649744668||
|0.772137560330817|0.9234350237531648|0.026495498450750832|0.8419663625873759|0.15889989922432324|0.05682336740846916|0.2811580179446488|0.3038431568827379|0.550679151291298|0.4243268350279368||

##### multi-col-table

|0|1|2|3|4|5|6|7|8|9|
|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|:------:|
|0.1574541650401502|0.6022858922585795|0.20312146254252583|0.7920833222568394|0.44544431852514177|0.9442765325113265|0.6052848546091829|0.5716133018748567|0.2319258530229218|0.9449298413383158|
|0.0336690314226592|0.7723563929297459|0.7099725471843411|0.5366976453819621|0.3124684937098925|0.826036269893938|0.7313172664632944|0.39977557994187707|0.9708004036606988|0.8889895862500321|
|0.07600236782204017|0.7296361261603651|0.06301035222060924|0.11824113167977235|0.46420842768262205|0.584754986450429|0.32932850247288326|0.17923422491890417|0.47911624291921606|0.6193501077351342|
|0.403259204645088|0.8589780944587944|0.05689851858069883|0.924954558581016|0.9406846016980752|0.060458855450524984|0.5310650929933902|0.3813072675045661|0.8122655624983939|0.6745141649744668|
|0.772137560330817|0.9234350237531648|0.026495498450750832|0.8419663625873759|0.15889989922432324|0.05682336740846916|0.2811580179446488|0.3038431568827379|0.550679151291298|0.4243268350279368|

___

#### tables from dict and Key-Values

|XX|YY|ZZ|
|:------|:------|:------|
|162|312|152||
|173|213|513||
|712|123|612||

|Key|Val|
|:------:|:------:|
|1|X|
|2|Y|
|3|Z|

```
=-=-=-=-==-=-=-=-=
dict as pre-formatted text
=-=-=-=-==-=-=-=-=
1 : X
2 : Y
3 : Z
=-=-=-=-==-=-=-=-=

```

### Controlled-Tables

Similar to controlled lists, each row can have **variable** number of columns 

|0|1|2|3|4|5|6|7|8|9|
|------:|------:|------:|------:|------:|------:|------:|------:|------:|------:|
|0|1|2||
|0|1|2|3|4|

### URI-Links-Images

![fig](examples/my_logs/fig.png (using matplotlib))

[python.org-Homepage](https://www.python.org/ (python-page))

![python-logo](https://www.python.org/static/img/python-logo-large.c36dccadd999.png (python-image))

[Github-Homepage](https://www.github.com/ (github-page))

![Github-Logo](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHcAAAB3CAMAAAAO5y+4AAAAb1BMVEX///8bHyMAAAARFhsYHCAAAAoUGR4ABg4LERf09PQAAAefn58AAAPe3t7x8fEOFBnr6+uBgYLMzc2VlpcpLC6vr7DW1tfl5eVnaWrCw8NVVlenp6g6Ozx1dnhQUVKMjI1gYWJERki3uLgiJik0NjqNkMtOAAAGlklEQVRogd1b24KqMAyUUKFclKsKCKyo//+NB0SxtClQqC9n3hbcjm3aZJLU3U4VYXz3oqwuH4ZhpGWdRd49viiPooRjnjQ2gG/TwCJGB2IFtH0Cdp3k4W9Iz15DYG/2fDyIuQfSeGfdpIduohLOLzfQxjvoI3XywvatSc4PLKBF7mhhPV5LCBaR9giguR43szreA5ZNlZ106m2c89WAaaPiIJCeNrCey1WsPXO5enNXyivMwoJs1WLHgb2BtYNNY3XaaNNkexD4U2S91LCZtQPUSq47TqkWWsOgqcJanxZ6pyUw3cUnKll9ejAQ8JbR/ukx7RfLdlekm3YZsfbZLiP2fkHbEs/Y+P4b2pb4PkUbuzp3MgviTpzjS6rv3PIwU7nnqjkvRVuhaK2Kv1YnO7nBahktf4Ls6uRFjQGqPtMEUlbXE79FIZIYl99T8Hoc3gt3r8BK3ebUL2lhcuOhJnYoZ9wgG+yewFJmCtWgZE/cRCyC8VZ8mAfWoScwek0sM6CUBoE5+rIBVEzWcOQX0K5E2rNwcmG0AZ0IumUjZpeWwKO5ZVVUZVnxdNs/90FHT6AYq3ZB6IOouUrhCAH/zWrwwbj9nc5jeewc7kn2BHAJ7xsqfkdaJU/L2wL7zM5LDjKp5oSnSFDrnrArgAvGzkM4pjTjh1GG6HWJMf7iSDiwJcdNAbkvjDoOEEdxuoatqgURXlcYlaSsNa5IGPrNfA24ft874mb+kX277fq1cI5FXavZzCvu527C+fC+QPNb/vyqI8MiSlB8Xh/w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