Skip to content

how can use definition extension correctly ? #86

@firm1

Description

@firm1

Hi,

I use flexmark and i have a problem with definition extension.

This is my markdown text :

Definition 1
: My name is john
:
: **John riley**

Definition 2
: And you ?
:
: Me ? really ?

After processing, i have this html render

<dl>
<dt>Definition 1</dt>
<dd>My name is john</dd>
<dd>
<dd><strong>John riley</strong></dd>
</dd>
<dt>Definition 2</dt>
<dd>And you ?</dd>
<dd>
<dd>Me ? really ?</dd>
</dd>
</dl>

I would like something like that

<dl>
<dt>Definition 1</dt>
<dd>My name is john</dd>
<dd><strong>John riley</strong></dd>
</dl>
<dl>
<dt>Definition 2</dt>
<dd>And you ?</dd>
<dd>Me ? really ?</dd>
</dl>

Means, two blocks of <dl> instead one, and no double <dd> for second line of definition content.

This is my java code :

static final MutableDataHolder OPTIONS = new MutableDataSet()
            //.set(Parser.REFERENCES_KEEP, KeepType.LAST)
            .set(HtmlRenderer.INDENT_SIZE, 0)
            .set(HtmlRenderer.PERCENT_ENCODE_URLS, true)
            .set(Parser.EXTENSIONS, Arrays.asList(
                    AbbreviationExtension.create(),
                    TablesExtension.create(),
                    FootnoteExtension.create(),
                    AnchorLinkExtension.create(),
                    TypographicExtension.create(),
                    SuperscriptExtension.create(),
                    StrikethroughSubscriptExtension.create(),
                    EmojiExtension.create(),
                    AutolinkExtension.create(),
                    DefinitionExtension.create()

            ));

    public static final Parser PARSER = Parser.builder(OPTIONS).build();
    public static final HtmlRenderer RENDERER = HtmlRenderer.builder(OPTIONS).build();

    Node doc = markdown.PARSER.parse(md); // md is String of markdown content
    System.out.println(markdown.RENDERER.render(doc));

Can you explain me Definition Extension options ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions