Home | History | Annotate | Download | only in docs

Lines Matching full:markdown

1 Writing Extensions for Python-Markdown
7 Python-Markdown includes an API for extension writers to plug their own
28 * [Integrating your code into Markdown][]
37 Preprocessors munge the source text before it is passed into the Markdown
41 Preprocessors should inherit from ``markdown.preprocessors.Preprocessor`` and
49 class MyPreprocessor(markdown.preprocessors.Preprocessor):
62 Inline Patterns implement the inline HTML element syntax for Markdown such as
64 instances of classes that inherit from ``markdown.inlinepatterns.Pattern`` or
87 class EmphasisPattern(markdown.inlinepatterns.Pattern):
89 el = markdown.etree.Element('em')
93 As discussed in [Integrating Your Code Into Markdown][], an instance of this
94 class will need to be provided to Markdown. That instance would be created
103 a more sophisticated emphasis pattern already exists in Markdown). The fact is,
106 Therefore, Markdown provides a number of generic pattern classes that can
126 There may be other Pattern classes in the Markdown source that you could extend
138 A Treeprocessor should inherit from ``markdown.treeprocessors.Treeprocessor``,
144 class MyTreeprocessor(markdown.treeprocessors.Treeprocessor):
158 A Postprocessor should inherit from ``markdown.postprocessors.Postprocessor``
166 class TocPostprocessor(markdown.postprocessors.Postprocessor):
182 A Blockprocessor should inherit from ``markdown.blockprocessors.BlockProcessor``
215 The official Markdown syntax rules state that a blank line does not end a
240 not be indented as does some parts of the Markdown syntax.
268 An instance of the **``BlockParser``** is found at ``Markdown.parser``.
274 passed an entire document and is the only method the ``Markdown`` class
279 Parses a chunk of markdown text composed of multiple blocks and attaches
298 As mentioned, the Markdown parser converts a source document to an
300 Markdown has provided some helpers to ease that manipulation within the context
301 of the Markdown module.
304 ``markdown`` rather than importing it directly. This will ensure you are using
305 the same version of ElementTree as markdown. The module is named ``etree``
306 within Markdown.
308 from markdown import etree
310 ``markdown.etree`` tries to import ElementTree from any known location, first
322 some_element.text = markdown.AtomicString(some_text)
331 td1.text = markdown.AtomicString("Cell content") # Add plain text content
349 <h3 id="integrating_into_markdown">Integrating Your Code Into Markdown</h3>
352 Markdown about them and ensure that they are run in the proper sequence.
353 Markdown accepts a ``Extension`` instance for each extension. Therefore, you
354 will need to define a class that extends ``markdown.Extension`` and over-rides
357 the Markdown instance.
363 the Markdown class in [OrderedDict][]s. Your ``Extension`` class will need to
370 The ``extendMarkdown`` method of a ``markdown.Extension`` class accepts two
375 Markdown class. You should use this to
385 Some other things you may want to access in the markdown instance are:
394 Contains all the various global variables within the markdown module.
398 should be aware that the various undocumented or private parts of markdown
401 into the markdown pipeline. Consider yourself warned.
407 class MyExtension(markdown.Extension):
426 Generally speaking, within Markdown extensions you will be using the special
450 >>> import markdown
451 >>> od = markdown.OrderedDict()
479 extension components to the various markdown OrderedDicts.
500 Markdown class. For example, consider the following use of the [[Footnotes]]
503 md = markdown.Markdown(extensions=['footnotes'])
523 Then, each time ``reset`` is called on the Markdown instance, the ``reset``
533 ``markdown.Extension`` class in the following format:
539 command line or at the time Markdown is initiated:
541 markdown.py -x myextension(SOME_PARAM=2) inputfile.txt > output.txt
560 By following the above example, when Markdown is passed the name of your
564 You may have noted that the extensions packaged with Python-Markdown do not
566 part of the ``markdown.extensions`` package. Markdown will first try to import
567 from ``markdown.extensions.extname`` and upon failure, ``mdx_extname``. If both
568 fail, Markdown will continue without the extension.
570 However, Markdown will also accept an already existing instance of an extension.
573 import markdown
577 md = markdown.Markdown(extensions=[myext])
588 [Integrating your code into Markdown]: #integrating_into_markdown