-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Markdown text format doesn't produce markdown alignment #67
Comments
Hi @thchr The
Thanks! I am glad it is being useful :) |
When you say backend for markdown, what formats can it have? The different flavours of Markdown? And how do you plan to implement it? I may be able to put some time in this |
I am just thinking about a table like the text backend provides. The difference will be in the line below the header (which will have the alignment), and in the highlighter. I started to work on this, but I still not sure how can I do it. The "easiest" would be copy the entire text backend and just modify what I want, but that's bad. Hence, I started to split text backend in many functions so that they can be reused. I think I might be reaching the point in which those derivative backend would be simple to implement. |
Why does this need a different backend though? At the end, we are still returning a string right? Or maybe, we should depend on Markdown.jl (stdlib, so anyway installed) and return an MD object. Have a |
We have two things here:
That's why we need a new backend. A very simple one that will use almost everything from the text backend. |
Right, I see what you mean. |
I would also like this feature! |
Yes... after the refactoring I performed, it should be very easy to implement it. I will try to find some time to do this :) |
Any updates or thoughts here? Preferably would support the same set of tables that Pandoc does https://pandoc.org/MANUAL%202.html#tables |
Sorry for the delay :D It took a while to clean the code and now we can add the Markdown backend very easily. However, I will only be able to work on this after I submit the PRs to make PrettyTables.jl the default printing mechanism for HTML and LaTeX. |
I'm looking forward to this one, the convenience level is 1000 for a few workflows I have sharing datasets. |
Yeah, sorry for the delay :) I did a huge revamp to split functions in the text backend. Now, it should be easy to create the markdown backend with this functionality. I will try to find some time to implement this. |
+1 this would also be great to have! |
Hi! After all those years, I am starting to implement the markdown mode finally. However, I reached a problem. Since markdown tables does not allow multiple header lines, what should we do with the sub-headers? |
I generally do not use them anyway, so I would not mind if they were not
allowed in markdown.
Tyler Beason
tbeason.com
…On Sat, Oct 14, 2023, 8:34 PM Ronan Arraes Jardim Chagas < ***@***.***> wrote:
Hi! After all those years, I am starting to implement the markdown mode
finally. However, I reached a problem. Since markdown tables does not allow
multiple header lines, what should we do with the sub-headers?
—
Reply to this email directly, view it on GitHub
<#67 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACSBDQMV73CV343ANSEQ4N3X7MVQPANCNFSM4P2CLZCA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Done! PrettyTables.jl now has a true markdown back end :) julia> A = rand(4, 4)
4×4 Matrix{Float64}:
0.057819 0.199259 0.915048 0.214648
0.808271 0.914835 0.260779 0.288038
0.777272 0.621872 0.97033 0.478155
0.982788 0.707421 0.844574 0.741363
julia> pretty_table(A, alignment = [:l, :c, :r, :r], backend = Val(:markdown))
| **Col. 1** | **Col. 2** | **Col. 3** | **Col. 4** |
|:-----------|:----------:|-----------:|-----------:|
| 0.057819 | 0.199259 | 0.915048 | 0.214648 |
| 0.808271 | 0.914835 | 0.260779 | 0.288038 |
| 0.777272 | 0.621872 | 0.97033 | 0.478155 |
| 0.982788 | 0.707421 | 0.844574 | 0.741363 | |
Amazing! Many thanks! |
I may be misunderstanding or assuming more of the
tf=markdown
option than is intended, but I had been hoping to use this option to easily generate files with aligned markdown-formatted tables.The issue is best illustrated by example:
While the text entries are perfectly aligned, I had been hoping for
:--
,:--:
, and--:
header lines instead of just--
: without this, markdown table won't be properly aligned if subsequently rendered as Markdown. I.e., I had been hoping the output would be:PS. Thanks for a great package!
The text was updated successfully, but these errors were encountered: