showdownjs/showdown

Insert listItem on rule

开放

#636 创建于 2019年1月3日

 (3 条评论) (0 个反应) (1 位负责人)JavaScript (1,640 个派生)batch import
help wanted

仓库指标

星标
 (13,700 个星标)
PR 合并指标
 (平均合并 15小时 21分钟) (30 天内合并 3 个 PR)

描述

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?

贡献者指南