hgext.README
A fork of https://www.mercurial-scm.org/wiki/MarkdownExtension that tears out
most of its guts and just adds a single thing: a /readme
endpoint that will
display the repository's README
. If the README
ends with .md
or
.markdown
it will be rendered with python-markdown
, otherwise it will just
display the raw text in a <pre>
.
Usage
- Install
python-markdown
. - Clone this repository to
/example/hgext.readme
-
Add the following to your hgweb config:
[extensions] hgext.readme=/example/hgext.readme
[web] # optional; 'tip' is default value. markdown.changeid = tip
-
Create a
readme
template in whatever templates directory you're using and install it in themap
file (e.g.readme = readme.tmpl
). - Create the
readme.tmpl
and make it look like you want. Inside the template,{readme_content}
will contain the HTML of the README. - Optional: update the
default
inmap
to makereadme
the endpoint served at/
.
Security
This extension enables users with commit/push access to the repos to create arbitrary html content that may be browsed by other users. At this time no attempt has been made to detect or prevent attacks such as cross-site scripting (xss) and other types of attacks. In general this extension should only be used if you trust all users with push access.