showdownjs/showdown

Insert listItem on rule

Open

#636 aperta il 3 gen 2019

Vedi su GitHub
 (3 commenti) (0 reazioni) (1 assegnatario)JavaScript (1640 fork)batch import
help wanted

Metriche repository

Star
 (13.700 star)
Metriche merge PR
 (Merge medio 15h 21m) (3 PR mergiate in 30 g)

Descrizione

Hi!

Sorry for opening an issue for a question but couldnt find any issue related.

I'm trying to insert a listItem from a rule, the idea is that I'm creating a custom markdown rule that should insert a custom list (LI) element but seems like I cant insert a <li> element without a parent <ul> (which makes sense).

This is a sample of what im trying to achieve:

{
      type: 'lang',
      regex: /(^|\n)(listitem)\n/g,
      replace() {
        return `<li>List Item</li>\n`;
      },
}

Any idea of how can I achieve this?

Guida contributor