From: Waylan L. <way...@ic...> - 2017-03-09 22:05:18
|
Kalle, I would simply subclass the `UListProcessor` class and override the regex (`UListProcessor.RE`) so that it also matched your new bullet type, and then use the new subclass as a replacement for the `UListProcessor` instance. After all, all you are doing is adding a new bullet type for unordered lists. That said, I would strongly suggest you not use the hash character (`#`) as a bullet. It already serves as a hash style header. How would you differentiate between a header nested in a list item and your new list type? For example, consider your example list: * List begins here # New list-like thing In standard Markdown, that would render correctly as: <ul> <li> <p>List begins here</p> <h1>New list-like thing</h1> </li> </ul> In my experience, it is best **not** to introduce new syntax which directly conflicts with existing syntax. Of course, if you are also removing support for hash style headers, then that may make sense. Waylan On Wed, Mar 8, 2017 at 10:47 AM, Kalle Rutanen <ka...@hi...> wrote: > Hi there, > > I have extended Python Markdown with a new block-processor which > resembles a list, say with a bullet #. I am having problems with > making > it interact well with ordinary lists. Consider the following text: > > * List begins here > > # New list-like thing begins here (1) > > This should also be in the new thing. (2) > > Currently, the parser > a) parses the list-item with UListProcessor > b) parses the child-block (1) with ListIndentProcessor > c) sends the child-block (1) to be parsed by the NewThingProcessor > d) parses the child-block (2) with ListIndentProcessor > > The problem is, NewThingProcessor never gets the opportunity to deal > with the additional content in child-block (2): the child-block (2) is > not in the set of blocks when parsing child-block (1) in c). > > Is there a way to make this work? > > Kalle > > > ------------------------------------------------------------------------------ > Announcing the Oxford Dictionaries API! The API offers world-renowned > dictionary content that is easy and intuitive to access. Sign up for > an > account today to start using our lexical data to power your apps and > projects. Get started today and enter our developer competition. > http://sdm.link/oxford > _______________________________________________ > Python-markdown-discuss mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss |