Coder Social home page Coder Social logo

Add Rmarkdown table style about pander HOT 5 CLOSED

rapporter avatar rapporter commented on September 4, 2024
Add Rmarkdown table style

from pander.

Comments (5)

daroczig avatar daroczig commented on September 4, 2024

Thanks again!
After having a quick view on the PHP Markdown Extra syntax, implementing the alignment would not be much problematic IMHO. As the "simple" style already supports the alignment of the cells, only the separator should be updated for the rmarkdown style - as written on the PHP Markdown Extra homepage:

You can specify alignment for each column by adding colons to separator lines. A colon at the left of the separator line will make the column left-aligned; a colon on the right of the line will make the column right-aligned; colons at both side means the column is center-aligned.

So only the sep.hdr needs some update for the alignment if I am right. Could you tweak that please? If not, I would happily get the time to add that in the next few days.

And as I have never used this syntax: what happens if there is no header or col.names in the object with PHP Markdown Extra/knitr?

For example:

> pandoc.table(matrix(1:4, 2, 2))

---
1 3

2 4
---

from pander.

onesandzeroes avatar onesandzeroes commented on September 4, 2024

I hadn't thought considered when the object has no colnames: the table format seems to require the column names line, even if the column names are blank, so in order to get that matrix to print, you need:

|   |   |
|---|---|
| 1 | 3 |
| 2 | 4 |

I've created a new branch for myself to work on these kinds of issues without adding dozens of commits to the pull request, I'll see what I can put together over the next couple of days. I think I already have the tables working when there are no colnames, but I'll do some further testing and try to get alignment working as well.

from pander.

daroczig avatar daroczig commented on September 4, 2024

Awesome, thank you very much!

Please feel free to ping me at any time if I could help you with anything, and also please go ahead with adding dozens of commits to the pull request, IMHO there is no problem with that. Okay, thanks again.

from pander.

onesandzeroes avatar onesandzeroes commented on September 4, 2024

Alright, I now have the table style working with blank column names, and I've written a helper function to align all the columns according to the justify argument. I've only done some basic testing so far, but it's all looking good.

Here's some very quick examples of the results:

RMarkdown input file
Resulting Markdown file
HTML produced by knitr

It should all be in the pull request if you're happy to merge.

from pander.

daroczig avatar daroczig commented on September 4, 2024

That's awesome, thanks a lot!
Of course I've merged your commits.

from pander.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.