micromark / micromark-extension-gfm-table

micromark extension to support GFM tables
https://unifiedjs.com
MIT License
6 stars 6 forks source link

Parsing fails when disabling construct `codeIndented` (using `micromark-extension-mdx-md`) #10

Closed tumidi closed 1 year ago

tumidi commented 1 year ago

Initial checklist

Affected packages and versions

micromark-extension-gfm-table@1.0.5

Link to runnable example

https://codepen.io/tumidi/pen/GRXaMwZ

Steps to reproduce

Create a project with remark-mdx together with remark-gfm and use indentation inside JSX tags. micromark-extension-mdx-md will disable construct codeIndented which leads to this behavior. The bug report originates from this discussion.

Expected behavior

Tables should render independent of indentation level.

Actual behavior

Tables don't render for indentations with 4 spaces or larger.

Runtime

Node v16

Package manager

Other (please specify in steps to reproduce)

OS

Linux

Build and bundle tools

Vite

github-actions[bot] commented 1 year ago

Hi! This was marked as ready to be worked on! Note that while this is ready to be worked on, nothing is said about priority: it may take a while for this to be solved.

Is this something you can and want to work on?

Team: please use the area/* (to describe the scope of the change), platform/* (if this is related to a specific one), and semver/* and type/* labels to annotate this. If this is first-timers friendly, add good first issue and if this could use help, add help wanted.

wooorm commented 1 year ago

I verified that this now works since https://github.com/micromark/micromark-extension-gfm-table/commit/9033e980b4e5194e890cd71580d85a49dcf049de.

import {micromark} from 'micromark'
import {gfmTable, gfmTableHtml} from 'micromark-extension-gfm-table'
import {mdxjs} from 'micromark-extension-mdxjs'

const doc = `
<div>
  | a |
  | - |
  | b |
</div>

<div>
  <div>
    | a |
    | - |
    | b |
  </div>
</div>
`

const output = micromark(doc, {
  extensions: [gfmTable, mdxjs()],
  htmlExtensions: [gfmTableHtml]
})

console.log(output)

Yields:


<table>
<thead>
<tr>
<th>a</th>
</tr>
</thead>
<tbody>
<tr>
<td>b</td>
</tr>
</tbody>
</table>

<table>
<thead>
<tr>
<th>a</th>
</tr>
</thead>
<tbody>
<tr>
<td>b</td>
</tr>
</tbody>
</table>
wooorm commented 1 year ago

Released in 1.0.6!