Git Product home page Git Product logo

csvtomarkdowntable's Introduction

Hello!

I am a PHP, Go and TypeScript developer based in Minneapolis. Full stack capable, I generally prefer backend and data work as I find it less prickly.

I ❤️ tiny reusable modules with single responsibilities.

I have spent the last decade working in EdTech. Before that I spent five years building industrial and b2b software.

📈 Stats

Top Langs

csvtomarkdowntable's People

Contributors

curtisgibby avatar dependabot-preview[bot] avatar dependabot[bot] avatar donatj avatar terriann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

csvtomarkdowntable's Issues

Add Support for Double Bar Headers - Confluence Wiki Markup

Discovered your sample looking to convert some CSVs to a table for use in JIRA cloud comments and descriptions. The flavor of markdown used there has a different table syntax and uses two bar lines instead of a separator bar row to indicate the <th> cells.

Documentation reference: https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=tables

Example

From

key,sandwich,points,notes
1,Chicken Salad,48,With just enough seasoning
2,Turkey & Bacon,263,Healthy but with bacon
3,Bologna and cheese,1,Classic Favorite

To

|| key || sandwich           || points || notes                      || 
|  1    | Chicken Salad       | 48      | With just enough seasoning  | 
|  2    | Turkey & Bacon      | 263     | Healthy but with bacon      | 
|  3    | Bologna and cheese  | 1       | Classic Favorite            | 

Which displays as (in JIRA Cloud)
screenshot

In case you're open to this feature I will submit a pull request with tests that I worked on.

Happy to make updates based on your feedback. First time contributor here (new to Mocha and TypeScript too) so thanks in advance for your patience!

It does not work in China

I have found it does not work in china unless I can access google:

<script src="//ajax.googleapis.com/ajax/libs/mootools/1.2.2/mootools-yui-compressed.js"></script>

So attached script can help those cannot access google.

Escape special Markdown symbols

Input csv

id,name
1,Name|sok

Output Markdown
This is a wrong markdown table because it has not been escaped

| id | name     | 
|----|----------| 
| 1  | Name|sok | 

Can you do the same as tableconvert.com to support special character escaping?

Escape `

Trying from something like this:

`a, à
`e, è
`i, ì
`o, ò
`u, ù
`A, À
`E, È
`I, Ì
`O, Ò
`U, Ù

Is it doable? Github cannot seem to escape it.

Had to convert input from dos-style to unix-style

I was running into a problem with a CSV that I suspect came from a mac or a windows computer, and the markdown wasn't rendering.

I didn't have a clue at first what the problem was, until I was scrolling across lines in the CSV in the Sublime text editor and I noticed what seemed like an extra pause going across an invisible character. I then opened the file in the Vim editor, and noticed a ^M symbol.

I did a little research and found that it was probably to do with how end-of-lines are formatted.

I used a program on my system, named dos2unix, to convert the file to unix-style. I think this was necessary for the end-of-line characters to be read properly.

Anyway, I hope this wasn't too vague. I can't share the file as it is due to it containing sensitive data. I could scrub the sensitive data out, if you think it would be helpful to have it as an example.

[ and ] in entries causes parsing issue

I have CSV data, as shown.

"foo";"bar";"baz"
"1";"2";"[foo -- bar baz]"

There appears to be an issue where the [ and ] causes the parser to break, and place the 2nd and third column together.

Screen Shot 2022-10-10 at 1 23 41 PM

It should instead be able to take the [ ] and display it correctly, like shown below (but without the [ and ])

Screen Shot 2022-10-10 at 1 24 02 PM

vs code plugin

Awesome tool! Is there any vs code plugin there ?

From vs code, right click in any *.md file, show a context menu Paste As Markdown Table!

Wow! Exciting.

csvToMarkdown is not a function

I am trying to do this simple example

import { csvToMarkdown } from "csv-to-markdown-table";

console.log(csvToMarkdown("header1,header2,header3\nValue1,Value2,Value3", ",", true))

And I get csvToMarkdown is not a function, what should I do?

CSV doesn't observe quoted strings.

When using a CSV format that has quoted values that contain a comma the tool splits the value into columns.

Given

1,2,3
a,b,c
a,"b,b",c

Expected:

1 2 3
a b c
a b,b c

Actual

1 2 3
a b c
a "b b" c

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.