Skip to content

Table parsing pulls in previous paragraph #18

@mikethea1

Description

@mikethea1

Code:

use FastVolt\Helper\Markdown;

$text = <<<MD
A

| B | C |
|-------------|---------|
| B1 | C1 |
MD;

// Initialize the parser
$markdown = new Markdown(); // or Markdown::new()

// set markdown content 
$markdown->setContent($text);

// compile and get as raw HTML
echo $markdown->getHtml();

Output:

<table>
<thead>
<tr>
<th>A</th>
<th>B</th>
<th>C</th>
</tr>
</thead>
<tbody>
<tr>
<td>B1</td>
<td>C1</td>
</tr>
</tbody>
</table>

Note that A has become a table header instead of being a separate paragraph.

See also erusev/parsedown#929

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions