11# Python-Markdown Github-Links Extension
22
3- An extension to Python-Markdown which adds support for a shorthand for GitHub
4- specific links .
3+ An extension to Python-Markdown which adds support for shorthand links to GitHub
4+ users, repositories, issues and commits .
55
66## Installation
77
@@ -31,7 +31,7 @@ markdown.markdown(
3131 src,
3232 extensions = [' mdx_gh_links' ],
3333 extension_configs = {
34- ' mdx_gh_links' : {' user' : ' foo' , ' project ' : ' bar' }
34+ ' mdx_gh_links' : {' user' : ' foo' , ' repo ' : ' bar' }
3535 }
3636)
3737```
@@ -41,7 +41,7 @@ markdown.markdown(
4141
4242``` python
4343from mdx_gh_links import GithubLinks
44- markdown.markdown(src, extensions = [GithubLinks(user = ' foo' , project = ' bar' )])
44+ markdown.markdown(src, extensions = [GithubLinks(user = ' foo' , repo = ' bar' )])
4545```
4646
4747The following configuration options are available:
@@ -51,10 +51,10 @@ The following configuration options are available:
5151A GitHub user name or organization. If no user or organization is specified in
5252a GitHub link, then the value of this option will be used.
5353
54- #### project
54+ #### repo
5555
56- A GitHub project . If no project is specified in a GitHub link, then the value
57- of this option will be used.
56+ A GitHub repository . If no repository is specified in a GitHub link, then the
57+ value of this option will be used.
5858
5959## Syntax
6060
@@ -65,14 +65,14 @@ unique to that type of link. See each type for the specific class assigned.
6565
6666### Mentions
6767
68- Link directly to a GitHub user, organization or project . Note that no
69- verification is made that an actual user, organization or project exists. As the
70- syntax does not differentiate between users and organizations, all organizations
71- are assumed to be users. However, this assumption is only reflected in the
72- title of a link.
68+ Link directly to a GitHub user, organization or repository . Note that no
69+ verification is made that an actual user, organization or repository exists. As
70+ the syntax does not differentiate between users and organizations, all
71+ organizations are assumed to be users. However, this assumption is only
72+ reflected in the title of a link.
7373
7474Mentions use the format ` @{user} ` to link to a user or organization and
75- ` @{user}/{project } ` to link to a project . The defaults defined in the
75+ ` @{user}/{repo } ` to link to a repository . The defaults defined in the
7676configuration options are ignored by mentions. A mention may be escaped by
7777adding a backslash immediately before the at sign (` @ ` ).
7878
@@ -81,11 +81,11 @@ All mentions are assigned the `gh-mention` class.
8181The following table provides some examples:
8282
8383| shorthand | href | rendered result |
84- | ----------- | ---------------------------- | ------------------------------------------------------------------|
85- | ` @foo ` | ` https://github.com/foo ` | [ @foo ] ( https://github.com/foo " GitHub User: @foo ") |
86- | ` @foo/bar ` | ` https://github.com/foo/bar ` | [ @foo/bar ] ( https://github.com/foo/bar " GitHub Project : @foo/bar ") |
87- | ` \@123 ` | | @foo |
88- | ` \@foo/bar ` | | @foo/bar |
84+ | ----------- | ---------------------------- | -------------------------------------------------------------------- |
85+ | ` @foo ` | ` https://github.com/foo ` | [ @foo ] ( https://github.com/foo " GitHub User: @foo ") |
86+ | ` @foo/bar ` | ` https://github.com/foo/bar ` | [ @foo/bar ] ( https://github.com/foo/bar " GitHub Repository : @foo/bar ") |
87+ | ` \@123 ` | | @foo |
88+ | ` \@foo/bar ` | | @foo/bar |
8989
9090### Issues
9191
@@ -94,19 +94,19 @@ is made that an actual issue or PR exists. As the syntax does not differentiate
9494between Issues and PRs, all URLs point to "issues". Fortunately, GitHub will
9595properly redirect an issue URL to a PR URL if appropriate.
9696
97- Issue links use the format ` #{num} ` or ` {user}/{project }#{num} ` . ` {num} ` is the
98- number assigned to the issue or PR. ` {user} ` and ` {project } ` will use the
97+ Issue links use the format ` #{num} ` or ` {user}/{repo }#{num} ` . ` {num} ` is the
98+ number assigned to the issue or PR. ` {user} ` and ` {repo } ` will use the
9999defaults defined in the configuration options if not provided. An issue link may
100100be escaped by adding a backslash immediately before the hash mark (` # ` ).
101101
102102All issue links are assigned the ` gh-issue ` class.
103103
104104The following table provides various examples (with the defaults set as
105- ` user='user', project='project ' ` ):
105+ ` user='user', repo='repo ' ` ):
106106
107107| shorthand | href | rendered result |
108108| -------------- | -------------------------------------------- | ----------------------------------------------------------------------------------- |
109- | ` #123 ` | ` https://github.com/user/project /issues/123 ` | [ #123 ] ( https://github.com/user/project /issues/123 " GitHub Issue user/project #123 ") |
109+ | ` #123 ` | ` https://github.com/user/repo /issues/123 ` | [ #123 ] ( https://github.com/user/repo /issues/123 " GitHub Issue user/repo #123 ") |
110110| ` foo/bar#123 ` | ` https://github.com/foo/bar/issues/123 ` | [ foo/bar #123 ] ( https://github.com/foo/bar/issues/123 " GitHub Issue foo/bar #123 ") |
111111| ` \#123 ` | | #123 |
112112| ` foo/bar\#123 ` | | foo/bar #123 |
@@ -117,21 +117,21 @@ Link directly to a GitHub Commit. Note that no verification is made that an
117117actual commit exists.
118118
119119Commit links consist of a complete 40 character SHA hash and may optionally be
120- prefaced by ` {user}@ ` or ` {user/project }@ ` . ` {user} ` and ` {project } ` will use
121- the defaults defined in the configuration options if not provided. To avoid a 40
120+ prefaced by ` {user}@ ` or ` {user/repo }@ ` . ` {user} ` and ` {repo } ` will use the
121+ defaults defined in the configuration options if not provided. To avoid a 40
122122character hash from being linked, wrap it in a code span.
123123
124- All issue links are assigned the ` gh-commit ` class.
124+ All commit links are assigned the ` gh-commit ` class.
125125
126126The following table provides various examples (with the defaults set as
127- ` user='user', project='project ' ` ):
128-
129- | shorthand | href | rendered result |
130- | -------------------------------------------------- | --------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
131- | ` 72df691791fb36f00cf5363fefe757c8d3042656 ` | ` https://github.com/user/project /commit/72df691791fb36f00cf5363fefe757c8d3042656 ` | [ 72df691] ( https://github.com/user/project /commit/72df691791fb36f00cf5363fefe757c8d3042656 " GitHub Commit: user/project @72df691791fb36f00cf5363fefe757c8d3042656 ") |
132- | ` foo@72df691791fb36f00cf5363fefe757c8d3042656 ` | ` https://github.com/foo/project /commit/72df691791fb36f00cf5363fefe757c8d3042656 ` | [ foo@72df691] ( https://github.com/foo/project /commit/72df691791fb36f00cf5363fefe757c8d3042656 " GitHub Commit: foo/project @72df691791fb36f00cf5363fefe757c8d3042656 ") |
133- | ` foo/bar@72df691791fb36f00cf5363fefe757c8d3042656 ` | ` https://github.com/foo/bar/commit/72df691791fb36f00cf5363fefe757c8d3042656 ` | [ foo/bar@72df691] ( https://github.com/foo/bar/commit/72df691791fb36f00cf5363fefe757c8d3042656 " GitHub Commit: foo/bar@72df691791fb36f00cf5363fefe757c8d3042656 ") |
134- | `` `72df691791fb36f00cf5363fefe757c8d3042656` `` | | ` 72df691791fb36f00cf5363fefe757c8d3042656 ` |
127+ ` user='user', repo='repo ' ` ):
128+
129+ | shorthand | href | rendered result |
130+ | -------------------------------------------------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------|
131+ | ` 72df691791fb36f00cf5363fefe757c8d3042656 ` | ` https://github.com/user/repo /commit/72df691791fb36f00cf5363fefe757c8d3042656 ` | [ 72df691] ( https://github.com/user/repo /commit/72df691791fb36f00cf5363fefe757c8d3042656 " GitHub Commit: user/repo @72df691791fb36f00cf5363fefe757c8d3042656 ") |
132+ | ` foo@72df691791fb36f00cf5363fefe757c8d3042656 ` | ` https://github.com/foo/repo /commit/72df691791fb36f00cf5363fefe757c8d3042656 ` | [ foo@72df691] ( https://github.com/foo/repo /commit/72df691791fb36f00cf5363fefe757c8d3042656 " GitHub Commit: foo/repo @72df691791fb36f00cf5363fefe757c8d3042656 ") |
133+ | ` foo/bar@72df691791fb36f00cf5363fefe757c8d3042656 ` | ` https://github.com/foo/bar/commit/72df691791fb36f00cf5363fefe757c8d3042656 ` | [ foo/bar@72df691] ( https://github.com/foo/bar/commit/72df691791fb36f00cf5363fefe757c8d3042656 " GitHub Commit: foo/bar@72df691791fb36f00cf5363fefe757c8d3042656 ") |
134+ | `` `72df691791fb36f00cf5363fefe757c8d3042656` `` | | ` 72df691791fb36f00cf5363fefe757c8d3042656 ` |
135135
136136## License
137137
0 commit comments