1
1
# Python-Markdown Github-Links Extension
2
2
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 .
5
5
6
6
## Installation
7
7
@@ -31,7 +31,7 @@ markdown.markdown(
31
31
src,
32
32
extensions = [' mdx_gh_links' ],
33
33
extension_configs = {
34
- ' mdx_gh_links' : {' user' : ' foo' , ' project ' : ' bar' }
34
+ ' mdx_gh_links' : {' user' : ' foo' , ' repo ' : ' bar' }
35
35
}
36
36
)
37
37
```
@@ -41,7 +41,7 @@ markdown.markdown(
41
41
42
42
``` python
43
43
from 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' )])
45
45
```
46
46
47
47
The following configuration options are available:
@@ -51,10 +51,10 @@ The following configuration options are available:
51
51
A GitHub user name or organization. If no user or organization is specified in
52
52
a GitHub link, then the value of this option will be used.
53
53
54
- #### project
54
+ #### repo
55
55
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.
58
58
59
59
## Syntax
60
60
@@ -65,14 +65,14 @@ unique to that type of link. See each type for the specific class assigned.
65
65
66
66
### Mentions
67
67
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.
73
73
74
74
Mentions 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
76
76
configuration options are ignored by mentions. A mention may be escaped by
77
77
adding a backslash immediately before the at sign (` @ ` ).
78
78
@@ -81,11 +81,11 @@ All mentions are assigned the `gh-mention` class.
81
81
The following table provides some examples:
82
82
83
83
| 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 |
89
89
90
90
### Issues
91
91
@@ -94,19 +94,19 @@ is made that an actual issue or PR exists. As the syntax does not differentiate
94
94
between Issues and PRs, all URLs point to "issues". Fortunately, GitHub will
95
95
properly redirect an issue URL to a PR URL if appropriate.
96
96
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
99
99
defaults defined in the configuration options if not provided. An issue link may
100
100
be escaped by adding a backslash immediately before the hash mark (` # ` ).
101
101
102
102
All issue links are assigned the ` gh-issue ` class.
103
103
104
104
The following table provides various examples (with the defaults set as
105
- ` user='user', project='project ' ` ):
105
+ ` user='user', repo='repo ' ` ):
106
106
107
107
| shorthand | href | rendered result |
108
108
| -------------- | -------------------------------------------- | ----------------------------------------------------------------------------------- |
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 ") |
110
110
| ` 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 ") |
111
111
| ` \#123 ` | | #123 |
112
112
| ` foo/bar\#123 ` | | foo/bar #123 |
@@ -117,21 +117,21 @@ Link directly to a GitHub Commit. Note that no verification is made that an
117
117
actual commit exists.
118
118
119
119
Commit 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
122
122
character hash from being linked, wrap it in a code span.
123
123
124
- All issue links are assigned the ` gh-commit ` class.
124
+ All commit links are assigned the ` gh-commit ` class.
125
125
126
126
The 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 ` |
135
135
136
136
## License
137
137
0 commit comments