hvalev / py-markdown-table Goto Github PK
View Code? Open in Web Editor NEWTiny python library with zero dependencies which allows you to generate formatted markdown tables
License: MIT License
Tiny python library with zero dependencies which allows you to generate formatted markdown tables
License: MIT License
Currently there is no whitespace around the column separator which is as far as I know totally conforming to the standard but (in my personal opinion) a little bit hard to read in the raw view (and I have never seen it that way).
e.g.
test = [{"A": "row1_A", "B": "row1_B", "C": "row1_C"},
{"A": "row2_A", "B": "row2_B", "C": "row2_C"},
{"A": "row3_A", "B": "row3_B", "C": "row3_C"}]
tabletest = mdT.markdownTable(test).setParams(row_sep="markdown",
padding_weight="right",
quote=False).getMarkdown()
print(tabletest)
Output:
|A |B |C |
|------|------|------|
|row1_A|row1_B|row1_C|
|row2_A|row2_B|row2_C|
|row3_A|row3_B|row3_C|
I would prefer:
| A | B | C |
| ------ | ------ | ------ |
| row1_A | row1_B | row1_C |
| row2_A | row2_B | row2_C |
| row3_A | row3_B | row3_C |
Do you accept a PR for this (maybe also as an optional setting) or do you want it to keep it the way it is?
It would be nice have the table headers be capitalized via an option without needing to change all the dict keys to capitals. Additionally, it might be nice to allow custom headers different than the dict keys. One use case for this would be a boolean column where you may want to trail the column name with a question mark, for example. Another use case would be if you want spaces in the header.
If we create a link in a table [link] (url)
, as URLs are long & single string, Its pretty much always throws Value Error when clearly there is no need.
https://github.com/hvalev/py-markdown-table/blob/main/py_markdown_table/markdown_table.py#L276
Posible solution could be to detect url & ignore them, but i would say completely remove the Value error check also will also fine
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.