Skip to content
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

get a table in the browser #16

Closed
stla opened this issue Aug 24, 2016 · 5 comments
Closed

get a table in the browser #16

stla opened this issue Aug 24, 2016 · 5 comments
Assignees
Labels

Comments

@stla
Copy link

stla commented Aug 24, 2016

Hello,
Using json2md.min.js in the browser I get a problem with

var table3 = json2md({"table":{"header":["Petal.Length","Petal.Width","Species"],"rows":[{"Petal.Length":1.4,"Petal.Width":0.2,"Species":"setosa"},{"Petal.Length":1.4,"Petal.Width":0.2,"Species":"setosa"},{"Petal.Length":1.3,"Petal.Width":0.2,"Species":"setosa"}]}});

This returns the error: There is no such converter: table.

@IonicaBizau
Copy link
Owner

Probably I forgot to rebuild the browser file.

Will check it these days.

Sent from my iPhone

On 25 Aug 2016, at 01:16, stla notifications@github.com wrote:

Hello,
Using json2md.min.js in the browser I get a problem with

var table3 = json2md({"table":{"header":["Petal.Length","Petal.Width","Species"],"rows":[{"Petal.Length":1.4,"Petal.Width":0.2,"Species":"setosa"},{"Petal.Length":1.4,"Petal.Width":0.2,"Species":"setosa"},{"Petal.Length":1.3,"Petal.Width":0.2,"Species":"setosa"}]}});
This returns the error: There is no such converter: table.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@IonicaBizau
Copy link
Owner

Note there is a typo in your code: it should be headers instead of header.

json2md({
    "table": {
        "headers": ["Petal.Length", "Petal.Width", "Species"],
        "rows": [{
            "Petal.Length": 1.4,
            "Petal.Width": 0.2,
            "Species": "setosa"
        }, {
            "Petal.Length": 1.4,
            "Petal.Width": 0.2,
            "Species": "setosa"
        }, {
            "Petal.Length": 1.3,
            "Petal.Width": 0.2,
            "Species": "setosa"
        }]
    }
});

@stla
Copy link
Author

stla commented Aug 30, 2016

Thank you, it works 👍

@IonicaBizau
Copy link
Owner

Yay! 😀

On 30 Aug 2016, at 13:20, stla notifications@github.com wrote:

Thank you, it works 👍


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub #16 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/ACu084pImFaLFMdn-6vXiTdaCrrkMfbFks5qlAPwgaJpZM4Jsglk.

@rahuljha12527
Copy link

Hi i had to create a dynamic table in markdown
const data=[
{
name:"Frozen yoghurt",
calories:"159",
fat:"6",
carbs:"24",
protein:"4",
},
{
name:"Ice cream sandwich",
calories:"237",
fat:"9",
carbs:"37",
protein:"4",
},
{
name:"Eclair",
calories:"262",
fat:"16",
carbs:"24",
protein:"6",
},
{
name:"Cupcake",
calories:" 305",
fat:" 3",
carbs:"67",
protein:"4",
},
{
name:"Gingerbread",
calories:"356",
fat:"16",
carbs:"49",
protein:"3",
},

]
I have this data
jsonobj={
table:{
headers:[
"name",
"calories",
"fat",
" carbs",
"protein",
],

    rows:[]
}

};

console.log(json2md( {
table: {headers:[
"name",
"calories",
"fat",
" carbs",
"protein",
], rows:
[
data]
} }
))

I am using this but i got error cannot figure how i traverse or using loop to convert json2d format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants