mikaelbr / marked-terminal

A Renderer for the marked project. Allowing you to render Markdown to print to your Terminal
MIT License
425 stars 57 forks source link

Renderer.prototype.table: <tbody> text included in rendered output #315

Closed eezing closed 2 weeks ago

eezing commented 2 months ago

Problem

Description

Given source text includes a valid Markdown table
When calling parse with source text
Then rendered table includes <tbody> in cell 1
And has extra row at bottom 

Environment

Example

Code:

import { Marked } from 'marked';
import { markedTerminal } from 'marked-terminal';

const body = `
| Character Name | Hometown        | Description                               |
|----------------|-----------------|-------------------------------------------|
| Aria Windwalker| Elmridge        | A swift and agile archer from the woods   |
| Thorne Ironfist| Stonekeep       | A strong warrior from a mountain fortress |
| Lyra Moonshade | Sunhaven        | A cunning sorceress from a desert city    |
`;

// @ts-ignore
const m = new Marked(markedTerminal());

console.log(m.parse(body));

Console: Screenshot 2024-09-18 at 17 38 34

Possible Cause

https://github.com/mikaelbr/marked-terminal/blob/e8f60dd8a95291f2e58d6b1e43a0848719a53562/index.js#L231

Removing this line seemed to resolve the issues.

kabeep commented 1 month ago

Same problem and 100% reproduction.

Environment

node.js@18.18.0 ├── marked-terminal@7.1.0 └── marked@14.1.2

mikaelbr commented 2 weeks ago

Should be fixed in marked-terminal@7.2.1