Skip to content

Bold and Italic rules do not follow markdown syntax #5

@CerebralFart

Description

@CerebralFart

Tempest version

N/A

PHP version

8.5

Operating system

Linux

Description

The BoldRule and ItalicRule do not follow markdown syntax. They interpret any amount of asterisks or underscores as bold or italicized respectively, while the syntax specifies that one asterisk or underscore means italicized, two means bold faced and three means both italicized and bold faced.

The following code shows the problem:

$markdown = new Markdown();
echo $markdown->parse('*I should be italicized*')->html."\n";
echo $markdown->parse('__I should be bold faced__')->html."\n";

This currently renders

<p><strong>I should be italicized</strong></p>
<p><em>I should be bold faced</em></p>

While it should be

<p><em>I should be italicized</em></p>
<p><strong>I should be bold faced</strong></p>

I checked using Typora if I'm not misinterpreting the spec, but it too renders differently from what the library currently does

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions