SabrinaJewson / cmarker.typ

Transpile CommonMark Markdown to Typst, from within Typst!
MIT License
34 stars 2 forks source link

Tables are not formatting correctly #12

Open DaShMa518 opened 1 day ago

DaShMa518 commented 1 day ago

I inherited a small Typst project that uses cmarker, but when trying to add tables in markdown it does not format correctly. Your tests.md/tests.typ example suggests it should work, but I have been unable to get the tables portion to format in my attempts.

My quick tests are shown below.

typstTest.md

### This is a table in Markdown format

| Header1 | Header2 | Header3 | Header4 |
| :-----: | :-----: | :-----: | :------ |
| Row1_Value1 | Row1_Value2 | Row1_Value3 | Row1_Value4 |
| Row2_Value1 | Row2_Value2 | Row2_Value3 | Row2_Value4 |
| Row3_Value1 | Row3_Value2 | Row3_Value3 | Row3_Value4 |

### This is a table in raw Typst format

<!--raw-typst

#figure(
    table(
        columns: 4,
        table.header(
            [Header1], [Header2], [Header3], [Header4]
        ),
        [Row1_Value1],[Row1_Value2],[Row1_Value3],[Row1_Value4],
        [Row2_Value1],[Row2_Value2],[Row2_Value3],[Row2_Value4],
        [Row3_Value1],[Row3_Value2],[Row3_Value3],[Row3_Value4],
    ),
    caption: [This will be the displayed text describing the table]
) <table-metadata>

-->

typstTest.typ

#import "@preview/cmarker:0.1.1"

= Here is CMarker basic output
#cmarker.render(
  read("typstTest.md"),
)

\
= Here is CMarker with eval() output
#let out = (cmarker.render(show-source: true, read("typstTest.md")))
#eval(out.text, mode:"markup")

image

SabrinaJewson commented 1 day ago

That’s probably because I haven’t released the version with support for tables yet :P

For now, you can use it locally by cloning this Git repo.

DaShMa518 commented 1 day ago

Aha! That's good to hear. I thought for sure I was missing something simple and I kept going around and around attempting to figure it out.

Thanks for the quick reply!