From: <way...@ic...> - 2017-05-02 23:47:23
|
The tutorial covers the simplest parts of the API. It only gets more complex from there. However, I’m sure you can work through it. I would suggest making a simple extension. Something that is less complex that what you want. That will get you familiar with the API. Then you can build on that knowledge by building the extension you want. It may also help to consider alternative ways of designing your syntax. For example, some years ago someone asked for help in creating an extension which embedded YouTube videos. He had a special syntax that he wanted to use. I suggested that he just use regular Markdown links and alter the link parser to check for YouTube links and output different HTML. It turned out that was a much better (and more extendable) solution which is still used by various implementations today. I find your description of your input and desired output rather vague, so I can’t comment on it specifically. But if you really can’t incorporate your needs into existing Markdown syntax, then I would start with writing a regular expression which matches your desired syntax. Once you have that, then you can reference the tutorial to write an inlinePattern which pulls the data from a match against your regular expression, build an ElementTree element, and return it. Everything else is just boilerplate code and doesn’t change much between extensions. Waylan On May 1, 2017, 11:38 PM -0400, Yellow Elephant <yel...@gm...>, wrote: > Hi, I want to make a quite simple extension. I have followed the basic tutorial and looked through the API. Unfortunately that is still a bit too advanced for me, and the tutorial covered something that I didn't want to do. > > What I want to be able to do: > > 1. User input: [command] foo [/command] > 2. Output: <htlm tag that uses foo> > > //Yellephant > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Python-markdown-discuss mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss |