

Starting today, GitHub supports relative links in markup files. Update 30th, January 2013, 16 months later: GitHub Blog Post Relative links in markup files: Update: I opened an issue against GitHub for this feature request. Now how do I get it to pick up the current branch in the README.md at the root of the repository? This is expected because at this point the starting URL is in the branch. Here is a working example of what I mean: md to another within the same branch and not have to worry about which branch I'm in (avoid having to do an absolute URL that includes the branch name). My Project has a subdir named myLib, see below. The preferred method is to pass in an instance of an extension, whichĭoes not require use of the extension_configs keyword at all.Is there a way to create a URL anchor,, link from within a Markdown file, to another file within the same repository and branch (aka a link relative to the current branch)?įor example, in the master branch I have a README.md file, which I would like do something like: # My Project When loading an extension by name (as a string), you can only pass inĬonfiguration settings to the extension by using the Check the documentation for a specificĮxtension to determine if it supports this feature. For example, in that case one could doĮxtensions=. MakeExtension function which returns an instance of the extension, then If only one extension is defined within a module and the module includes a Then load the extension as follows: markdown.markdown(text, extensions=) Therefore, if you were to import the class like this: from path.to.module import MyExtClass The class must be at the end of the name and be separated by a

Generally, a class should be specified in If an extension does not have a registered entry point, Python’s dot Name myext assigned to it and the extension is properly installed, thenĭo the following: markdown.markdown(text, extensions=) Simply include the defined name asĪ string in the list of extensions. See the documentation specific to an extension for the string name assigned Registered entry point of any installed extension or the importable path If an extension name is provided as a string, the string must either be the

For example: from markdown.extensions import Extension Of and any configuration options should beĭefined when initiating the class instance rather than using theĮxtension_configs keyword. When passing in extension instances, each class instance must be a subclass Should only be used when it is impossible to import the Extension Classĭirectly (from the command line or in a template). The preferred method is to pass in an instance of an extension. The list of extensions may contain instances of extensions and/or strings A few commonly used extensions are shipped with the markdown Write extensions to the parser adding their own additions or changes to the Python-Markdown provides an API for third parties to If you want to write the output to disk, you must encode it yourself: with open("some_file.html", "w", encoding="utf-8", errors="xmlcharrefreplace") as output_file: For example: with open("some_file.txt", "r", encoding="utf-8") as input_file: as UTF-8), it is your responsibility to decode it. Do not pass binary strings to it! If your input isĮncoded, (e.g.

Python-Markdown expects a Unicode string as input (some simple ASCII binary strings may work only byĬoincidence) and returns output as a Unicode string.
