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

fix demo table tokens #1638

Merged
merged 3 commits into from Apr 10, 2020
Merged

fix demo table tokens #1638

merged 3 commits into from Apr 10, 2020

Conversation

UziTech
Copy link
Member

@UziTech UziTech commented Apr 8, 2020

Marked version: master

Description

Fix lexer data in demo

Example

| a | b |
|---|---|
| 1 | 2 |
| 3 | 4 |

current demo:

{type:"table", header:"a,b", align:",", cells:"1,2,3,4", raw:"| a | b |\\n|---|---|\\n| 1 | 2 |\\n| 3 | 4 |", tokens: [

]}

this PR demo:

[
{type:"table", header:["a", "b"], align:[null, null], cells:[["1", "2"], ["3", "4"]], raw:"| a | b |\n|---|---|\n| 1 | 2 |\n| 3 | 4 |", tokens:{header:[[
  {type:"text", raw:"a", text:"a"}
], [
  {type:"text", raw:"b", text:"b"}
]], cells:[[[
  {type:"text", raw:"1", text:"1"}
], [
  {type:"text", raw:"2", text:"2"}
]], [[
  {type:"text", raw:"3", text:"3"}
], [
  {type:"text", raw:"4", text:"4"}
]]]}}
]

I'm not sure if we should just use JSON.stringify

JSON.stringify:

[
  {
    "type": "table",
    "header": [
      "a",
      "b"
    ],
    "align": [
      null,
      null
    ],
    "cells": [
      [
        "1",
        "2"
      ],
      [
        "3",
        "4"
      ]
    ],
    "raw": "| a | b |\n|---|---|\n| 1 | 2 |\n| 3 | 4 |",
    "tokens": {
      "header": [
        [
          {
            "type": "text",
            "raw": "a",
            "text": "a"
          }
        ],
        [
          {
            "type": "text",
            "raw": "b",
            "text": "b"
          }
        ]
      ],
      "cells": [
        [
          [
            {
              "type": "text",
              "raw": "1",
              "text": "1"
            }
          ],
          [
            {
              "type": "text",
              "raw": "2",
              "text": "2"
            }
          ]
        ],
        [
          [
            {
              "type": "text",
              "raw": "3",
              "text": "3"
            }
          ],
          [
            {
              "type": "text",
              "raw": "4",
              "text": "4"
            }
          ]
        ]
      ]
    }
  }
]

Contributor

  • no tests required for this PR.

Committer

In most cases, this should be a different person than the contributor.

  • Draft GitHub release notes have been updated.
  • CI is green (no forced merge required).
  • Merge PR

@vercel
Copy link

vercel bot commented Apr 8, 2020

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/markedjs/markedjs/pyftzc0xw
✅ Preview: https://markedjs-git-fork-uzitech-fix-demo.markedjs.now.sh

@UziTech UziTech added the category: docs Documentation changes label Apr 8, 2020
@UziTech UziTech requested review from joshbruce and styfle April 8, 2020 23:42
@vercel vercel bot requested a deployment to Preview April 8, 2020 23:51 Abandoned
@vercel
Copy link

vercel bot commented Apr 8, 2020

Deployment failed with the following error:

request to https://api.zeit.co/v10/now/deployments?teamId=team_mmn2h2Sxu9w5qKips7VAfhd2&skipAutoDetectionConfirmation=1 failed, reason: socket hang up

@UziTech

This comment has been minimized.

@styfle
Copy link
Member

styfle commented Apr 10, 2020

Great description! Can we add that example as a test?

Update: I just realized this is only used on the demo page 🤔

@UziTech UziTech merged commit 0ad3a9e into markedjs:master Apr 10, 2020
@UziTech UziTech deleted the fix-demo branch April 10, 2020 17:18
@UziTech
Copy link
Member Author

UziTech commented Apr 10, 2020

Ya the tokens are fine. This just fixes how the tokens are displayed on the demo page.

@UziTech UziTech mentioned this pull request Apr 20, 2020
12 tasks
zhenalexfan pushed a commit to zhenalexfan/MarkdownHan that referenced this pull request Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: docs Documentation changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants