github-markup 6.0.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +25 -6
- data/.github/workflows/stale.yml +1 -1
- data/.gitignore +1 -0
- data/CONTRIBUTING.md +12 -0
- data/Gemfile +2 -6
- data/Gemfile.lock +65 -44
- data/HISTORY.md +52 -0
- data/README.md +5 -1
- data/github-markup.gemspec +11 -6
- data/lib/github/commands/rest2html +1 -0
- data/lib/github/markup/markdown.rb +87 -3
- data/lib/github/markup/rdoc.rb +5 -1
- data/lib/github/markup.rb +1 -2
- data/lib/github/markups.rb +10 -10
- data/lib/github-markup.rb +1 -1
- data/test/coverage_test.rb +368 -0
- data/test/fixtures/cat.sh +2 -0
- data/test/fixtures/empty.sh +3 -0
- data/test/markdown_test.rb +96 -0
- data/test/markup_test.rb +11 -9
- data/test/markups/README.asciidoc.html +6 -6
- data/test/markups/README.creole.html +1 -5
- data/test/markups/README.directives.rst.html +2 -2
- data/test/markups/README.litcoffee.html +5 -5
- data/test/markups/README.long.rst.html +220 -362
- data/test/markups/README.mediawiki.html +20 -20
- data/test/markups/README.org.html +30 -39
- data/test/markups/README.pod.html +15 -19
- data/test/markups/README.rdoc.html +4 -7
- data/test/markups/README.rst.html +26 -47
- data/test/markups/README.rst.txt.html +5 -10
- data/test/markups/README.toc.asciidoc.html +10 -12
- data/test/markups/README.toc.rst.html +7 -8
- data/test/test_helper.rb +29 -0
- metadata +51 -30
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ff91a38bd9532efbc68ffc793d856a1f5af72e1831d900ed8385acc0147a9701
|
|
4
|
+
data.tar.gz: ada0dc4fabe2ee882f561de3ce4b793d7b57dabb93970feaf95de78631630686
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0c535823d7f8d1628c6d26e88ade186062481ccac28205acc1db60d586fea0fe63f2c922dc51f63eb48d66b64e7e49054c84f19d22b5be15a9a204a4d9ab8328
|
|
7
|
+
data.tar.gz: 1edab0acae8bbd2f7eb2d46d5932643b611372412112d8f2b5203b51ee67f0fd3c288eeb61888557b8e2bb4ff77df393dc1e166d5e36b13837352653af057c34
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -9,33 +9,52 @@ permissions:
|
|
|
9
9
|
|
|
10
10
|
jobs:
|
|
11
11
|
build:
|
|
12
|
-
name: "Test / Ruby ${{ matrix.ruby }}"
|
|
12
|
+
name: "Test / Ruby ${{ matrix.ruby }} / RDoc ${{ matrix.rdoc }} / CommonMarker ${{ matrix.commonmarker }}"
|
|
13
13
|
runs-on: ubuntu-latest
|
|
14
|
+
env:
|
|
15
|
+
RDOC_VERSION: "~> ${{ matrix.rdoc }}"
|
|
16
|
+
COMMONMARKER_VERSION: "${{ matrix.commonmarker }}"
|
|
14
17
|
strategy:
|
|
15
18
|
matrix:
|
|
19
|
+
commonmarker:
|
|
20
|
+
- "~> 2.8.2"
|
|
21
|
+
rdoc:
|
|
22
|
+
- "7.2.0"
|
|
16
23
|
ruby:
|
|
17
24
|
- "3.3"
|
|
18
25
|
- "3.4"
|
|
19
26
|
- "4.0"
|
|
27
|
+
include:
|
|
28
|
+
- ruby: "4.0"
|
|
29
|
+
rdoc: "8.0"
|
|
30
|
+
commonmarker: "~> 2.8.2"
|
|
31
|
+
- ruby: "3.4"
|
|
32
|
+
rdoc: "7.2.0"
|
|
33
|
+
commonmarker: "0.23.12"
|
|
20
34
|
fail-fast: false
|
|
21
35
|
|
|
22
36
|
steps:
|
|
23
37
|
- name: Checkout
|
|
24
|
-
uses: actions/checkout@
|
|
38
|
+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
25
39
|
with:
|
|
26
40
|
fetch-depth: 10
|
|
41
|
+
persist-credentials: false
|
|
27
42
|
|
|
28
|
-
- uses: ruby/setup-ruby@
|
|
43
|
+
- uses: ruby/setup-ruby@651ff0d62c5c79bed6d53ec518387aae20e72c1a # v1.329.0
|
|
29
44
|
with:
|
|
30
45
|
ruby-version: ${{ matrix.ruby }}
|
|
31
|
-
bundler-cache:
|
|
46
|
+
bundler-cache: ${{ matrix.rdoc == '7.2.0' && matrix.commonmarker == '~> 2.8.2' }}
|
|
32
47
|
|
|
33
|
-
-
|
|
48
|
+
- name: Resolve overridden parser dependencies
|
|
49
|
+
if: matrix.rdoc != '7.2.0' || matrix.commonmarker != '~> 2.8.2'
|
|
50
|
+
run: bundle update commonmarker rdoc
|
|
51
|
+
|
|
52
|
+
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
34
53
|
with:
|
|
35
54
|
# Required by lib/github/commands/rest2html (RST rendering)
|
|
36
55
|
python-version: "3.x"
|
|
37
56
|
|
|
38
|
-
- uses: actions/cache@
|
|
57
|
+
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
39
58
|
with:
|
|
40
59
|
path: ~/.cache/pip
|
|
41
60
|
key: ${{ runner.os }}-pip
|
data/.github/workflows/stale.yml
CHANGED
|
@@ -12,7 +12,7 @@ jobs:
|
|
|
12
12
|
pull-requests: write
|
|
13
13
|
|
|
14
14
|
steps:
|
|
15
|
-
- uses: actions/stale@
|
|
15
|
+
- uses: actions/stale@4391f3da665fdf50b6810c1a66712fb9ba21aa93 # v11.0.0
|
|
16
16
|
with:
|
|
17
17
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
18
18
|
stale-issue-message: >
|
data/.gitignore
CHANGED
data/CONTRIBUTING.md
CHANGED
|
@@ -37,6 +37,18 @@ To run the tests:
|
|
|
37
37
|
|
|
38
38
|
If nothing complains, congratulations!
|
|
39
39
|
|
|
40
|
+
CI tests RDoc 7.2 and 8.x. To test RDoc 8.x locally:
|
|
41
|
+
|
|
42
|
+
$ RDOC_VERSION='~> 8.0' bundle update rdoc
|
|
43
|
+
$ RDOC_VERSION='~> 8.0' bundle exec rake
|
|
44
|
+
|
|
45
|
+
CI also tests CommonMarker 0.23.12. To run the full suite with the legacy parser:
|
|
46
|
+
|
|
47
|
+
$ COMMONMARKER_VERSION=0.23.12 bundle update commonmarker
|
|
48
|
+
$ COMMONMARKER_VERSION=0.23.12 bundle exec rake
|
|
49
|
+
|
|
50
|
+
Run these commands in a separate checkout to keep the default lockfile unchanged. You can combine `COMMONMARKER_VERSION` and `RDOC_VERSION` to test both overrides.
|
|
51
|
+
|
|
40
52
|
## Releasing a new version
|
|
41
53
|
|
|
42
54
|
If you are the current maintainer of this gem:
|
data/Gemfile
CHANGED
|
@@ -4,15 +4,11 @@ gemspec
|
|
|
4
4
|
gem "redcarpet", :platforms => :ruby
|
|
5
5
|
gem "kramdown", :platforms => :jruby
|
|
6
6
|
gem "RedCloth"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
gem "commonmarker", git: "https://github.com/gjtorikian/commonmarker.git", tag: "v0.18.3"
|
|
10
|
-
gem "rdoc", "~> 6.13.1"
|
|
7
|
+
gem "commonmarker", ENV.fetch("COMMONMARKER_VERSION", "~> 2.8.2")
|
|
8
|
+
gem "rdoc", ENV.fetch("RDOC_VERSION", "~> 7.2.0")
|
|
11
9
|
gem "org-ruby", "0.9.12"
|
|
12
10
|
gem "creole", "~>0.5.0"
|
|
13
11
|
gem "wikicloth", "=0.8.3"
|
|
14
12
|
gem "twitter-text", "~> 1.14"
|
|
15
13
|
gem "asciidoctor", "~> 2.0.26"
|
|
16
|
-
gem "rake"
|
|
17
14
|
gem "rexml"
|
|
18
|
-
gem "nokogiri", "~> 1.19"
|
data/Gemfile.lock
CHANGED
|
@@ -1,98 +1,117 @@
|
|
|
1
|
-
GIT
|
|
2
|
-
remote: https://github.com/gjtorikian/commonmarker.git
|
|
3
|
-
revision: 2838ebaa83ee0081d481c21f3bc0e4cb3e8de9da
|
|
4
|
-
tag: v0.18.3
|
|
5
|
-
specs:
|
|
6
|
-
commonmarker (0.18.3)
|
|
7
|
-
ruby-enum (~> 0.5)
|
|
8
|
-
|
|
9
1
|
PATH
|
|
10
2
|
remote: .
|
|
11
3
|
specs:
|
|
12
|
-
github-markup (6.
|
|
4
|
+
github-markup (6.1.1)
|
|
5
|
+
rdoc (< 9)
|
|
13
6
|
|
|
14
7
|
GEM
|
|
15
8
|
remote: https://rubygems.org/
|
|
16
9
|
specs:
|
|
17
10
|
RedCloth (4.3.4)
|
|
18
|
-
activesupport (
|
|
11
|
+
activesupport (8.1.3)
|
|
19
12
|
base64
|
|
20
|
-
benchmark (>= 0.3)
|
|
21
13
|
bigdecimal
|
|
22
14
|
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
23
15
|
connection_pool (>= 2.2.5)
|
|
24
16
|
drb
|
|
25
17
|
i18n (>= 1.6, < 2)
|
|
18
|
+
json
|
|
26
19
|
logger (>= 1.4.2)
|
|
27
|
-
minitest (>= 5.1
|
|
20
|
+
minitest (>= 5.1)
|
|
28
21
|
securerandom (>= 0.3)
|
|
29
22
|
tzinfo (~> 2.0, >= 2.0.5)
|
|
23
|
+
uri (>= 0.13.1)
|
|
30
24
|
asciidoctor (2.0.26)
|
|
31
25
|
base64 (0.3.0)
|
|
32
|
-
|
|
33
|
-
bigdecimal (4.1.0)
|
|
26
|
+
bigdecimal (4.1.2)
|
|
34
27
|
builder (3.3.0)
|
|
35
28
|
cgi (0.5.1)
|
|
36
29
|
charlock_holmes (0.7.9)
|
|
30
|
+
commonmarker (2.8.2)
|
|
31
|
+
rb_sys (~> 0.9)
|
|
32
|
+
commonmarker (2.8.2-aarch64-linux)
|
|
33
|
+
commonmarker (2.8.2-arm-linux)
|
|
34
|
+
commonmarker (2.8.2-arm64-darwin)
|
|
35
|
+
commonmarker (2.8.2-x86_64-darwin)
|
|
36
|
+
commonmarker (2.8.2-x86_64-linux)
|
|
37
37
|
concurrent-ruby (1.3.6)
|
|
38
38
|
connection_pool (3.0.2)
|
|
39
|
-
crass (1.0.6)
|
|
40
39
|
creole (0.5.0)
|
|
41
|
-
date (3.
|
|
40
|
+
date (3.5.1)
|
|
41
|
+
docile (1.4.1)
|
|
42
42
|
drb (2.2.3)
|
|
43
|
+
erb (6.0.4)
|
|
43
44
|
expression_parser (0.9.0)
|
|
44
|
-
github-linguist (9.
|
|
45
|
+
github-linguist (9.5.0)
|
|
45
46
|
cgi
|
|
46
47
|
charlock_holmes (~> 0.7.7)
|
|
47
48
|
mini_mime (~> 1.0)
|
|
48
49
|
rugged (~> 1.0)
|
|
49
|
-
html-pipeline (
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
html-pipeline (3.2.4)
|
|
51
|
+
selma (~> 0.4)
|
|
52
|
+
zeitwerk (~> 2.5)
|
|
52
53
|
htmlentities (4.3.4)
|
|
53
54
|
i18n (1.14.8)
|
|
54
55
|
concurrent-ruby (~> 1.0)
|
|
56
|
+
json (2.19.5)
|
|
55
57
|
logger (1.7.0)
|
|
56
58
|
mini_mime (1.1.5)
|
|
57
59
|
mini_portile2 (2.8.9)
|
|
58
|
-
minitest (
|
|
59
|
-
|
|
60
|
+
minitest (6.0.6)
|
|
61
|
+
drb (~> 2.0)
|
|
62
|
+
prism (~> 1.5)
|
|
63
|
+
nokogiri (1.19.3)
|
|
60
64
|
mini_portile2 (~> 2.8.2)
|
|
61
65
|
racc (~> 1.4)
|
|
62
|
-
nokogiri (1.19.
|
|
66
|
+
nokogiri (1.19.3-aarch64-linux-gnu)
|
|
63
67
|
racc (~> 1.4)
|
|
64
|
-
nokogiri (1.19.
|
|
68
|
+
nokogiri (1.19.3-arm-linux-gnu)
|
|
65
69
|
racc (~> 1.4)
|
|
66
|
-
nokogiri (1.19.
|
|
70
|
+
nokogiri (1.19.3-arm64-darwin)
|
|
67
71
|
racc (~> 1.4)
|
|
68
|
-
nokogiri (1.19.
|
|
72
|
+
nokogiri (1.19.3-x86_64-darwin)
|
|
69
73
|
racc (~> 1.4)
|
|
70
|
-
nokogiri (1.19.
|
|
74
|
+
nokogiri (1.19.3-x86_64-linux-gnu)
|
|
71
75
|
racc (~> 1.4)
|
|
72
76
|
nokogiri-diff (0.3.0)
|
|
73
77
|
nokogiri (~> 1.5)
|
|
74
78
|
tdiff (~> 0.4)
|
|
75
79
|
org-ruby (0.9.12)
|
|
76
80
|
rubypants (~> 0.2)
|
|
77
|
-
|
|
81
|
+
prism (1.9.0)
|
|
82
|
+
psych (5.3.1)
|
|
78
83
|
date
|
|
79
84
|
stringio
|
|
80
85
|
racc (1.8.1)
|
|
81
|
-
rake (13.
|
|
82
|
-
|
|
86
|
+
rake (13.4.2)
|
|
87
|
+
rake-compiler-dock (1.12.0)
|
|
88
|
+
rb_sys (0.9.128)
|
|
89
|
+
rake-compiler-dock (= 1.12.0)
|
|
90
|
+
rdoc (7.2.0)
|
|
91
|
+
erb
|
|
83
92
|
psych (>= 4.0.0)
|
|
93
|
+
tsort
|
|
84
94
|
redcarpet (3.6.1)
|
|
85
95
|
rexml (3.4.4)
|
|
86
|
-
ruby-enum (0.9.0)
|
|
87
|
-
i18n
|
|
88
96
|
rubypants (0.7.1)
|
|
89
97
|
rugged (1.9.0)
|
|
90
|
-
sanitize (6.1.3)
|
|
91
|
-
crass (~> 1.0.2)
|
|
92
|
-
nokogiri (>= 1.12.0)
|
|
93
98
|
securerandom (0.4.1)
|
|
94
|
-
|
|
99
|
+
selma (0.5.0)
|
|
100
|
+
rb_sys (~> 0.9)
|
|
101
|
+
selma (0.5.0-aarch64-linux)
|
|
102
|
+
selma (0.5.0-arm-linux)
|
|
103
|
+
selma (0.5.0-arm64-darwin)
|
|
104
|
+
selma (0.5.0-x86_64-darwin)
|
|
105
|
+
selma (0.5.0-x86_64-linux)
|
|
106
|
+
simplecov (0.22.0)
|
|
107
|
+
docile (~> 1.1)
|
|
108
|
+
simplecov-html (~> 0.11)
|
|
109
|
+
simplecov_json_formatter (~> 0.1)
|
|
110
|
+
simplecov-html (0.13.2)
|
|
111
|
+
simplecov_json_formatter (0.1.4)
|
|
112
|
+
stringio (3.2.0)
|
|
95
113
|
tdiff (0.4.0)
|
|
114
|
+
tsort (0.2.0)
|
|
96
115
|
twitter-text (1.14.7)
|
|
97
116
|
unf (~> 0.1.0)
|
|
98
117
|
tzinfo (2.0.6)
|
|
@@ -100,12 +119,14 @@ GEM
|
|
|
100
119
|
unf (0.1.4)
|
|
101
120
|
unf_ext
|
|
102
121
|
unf_ext (0.0.9.1)
|
|
122
|
+
uri (1.1.1)
|
|
103
123
|
wikicloth (0.8.3)
|
|
104
124
|
builder
|
|
105
125
|
expression_parser
|
|
106
126
|
htmlentities
|
|
107
127
|
nokogiri
|
|
108
128
|
twitter-text
|
|
129
|
+
zeitwerk (2.8.2)
|
|
109
130
|
|
|
110
131
|
PLATFORMS
|
|
111
132
|
aarch64-linux
|
|
@@ -117,23 +138,23 @@ PLATFORMS
|
|
|
117
138
|
|
|
118
139
|
DEPENDENCIES
|
|
119
140
|
RedCloth
|
|
120
|
-
activesupport (~>
|
|
141
|
+
activesupport (~> 8.1.3)
|
|
121
142
|
asciidoctor (~> 2.0.26)
|
|
122
|
-
commonmarker
|
|
143
|
+
commonmarker (~> 2.8.2)
|
|
123
144
|
creole (~> 0.5.0)
|
|
124
145
|
github-linguist (>= 7.1.3)
|
|
125
146
|
github-markup!
|
|
126
|
-
html-pipeline (~>
|
|
147
|
+
html-pipeline (~> 3.2)
|
|
127
148
|
kramdown
|
|
128
|
-
minitest (~>
|
|
129
|
-
nokogiri (~> 1.19)
|
|
149
|
+
minitest (~> 6.0, >= 5.4.3)
|
|
150
|
+
nokogiri (~> 1.19.2)
|
|
130
151
|
nokogiri-diff (~> 0.3.0)
|
|
131
152
|
org-ruby (= 0.9.12)
|
|
132
|
-
rake
|
|
133
|
-
rdoc (~>
|
|
153
|
+
rake (~> 13)
|
|
154
|
+
rdoc (~> 7.2.0)
|
|
134
155
|
redcarpet
|
|
135
156
|
rexml
|
|
136
|
-
|
|
157
|
+
simplecov (~> 0.22)
|
|
137
158
|
twitter-text (~> 1.14)
|
|
138
159
|
wikicloth (= 0.8.3)
|
|
139
160
|
|
data/HISTORY.md
CHANGED
|
@@ -1,3 +1,55 @@
|
|
|
1
|
+
## 6.1.1 (unreleased)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* I restored the CommonMarker 0.x API without requiring a parser upgrade. Existing 0.x installations retain their rendering flags, extension validation, and output behavior.
|
|
6
|
+
* I retained CommonMarker 2.x support with its existing option behavior.
|
|
7
|
+
* I added full-suite CI coverage for CommonMarker 0.23.12 alongside the default 2.8.2 dependency.
|
|
8
|
+
|
|
9
|
+
The RDoc 8 and reStructuredText fixes listed below remain included.
|
|
10
|
+
|
|
11
|
+
## 6.1.0 - 2026-10-16 (withdrawn)
|
|
12
|
+
|
|
13
|
+
I withdrew this release because it required a CommonMarker upgrade for existing 0.x installations. The `v6.1.0` tag remains available for traceability.
|
|
14
|
+
|
|
15
|
+
### Compatibility Changes
|
|
16
|
+
|
|
17
|
+
* Require commonmarker 2.x when using the CommonMarker renderer; upgrade existing commonmarker 0.x installations [#2059](https://github.com/github/markup/pull/2059).
|
|
18
|
+
* Accept `VALIDATE_UTF8`, `LIBERAL_HTML_TAG`, `TABLE_PREFER_STYLE_ATTRIBUTES`, and `STRIKETHROUGH_DOUBLE_TILDE` without applying them [#2059](https://github.com/github/markup/pull/2059).
|
|
19
|
+
* Preserve soft line breaks with `NOBREAKS` instead of converting them to spaces [#2059](https://github.com/github/markup/pull/2059).
|
|
20
|
+
* Apply `HARDBREAKS` and `NOBREAKS` in their supplied order; the last flag wins, replacing the old `HARDBREAKS` precedence [#2059](https://github.com/github/markup/pull/2059).
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* Support RDoc 8 formatter initialization and declare `rdoc < 9` as a runtime dependency [#2109](https://github.com/github/markup/pull/2109), [#2104](https://github.com/github/markup/pull/2104).
|
|
25
|
+
* Restore reStructuredText section and table-of-contents anchors with docutils 0.18 and later [#2081](https://github.com/github/markup/pull/2081), [#2087](https://github.com/github/markup/pull/2087).
|
|
26
|
+
|
|
27
|
+
### Development
|
|
28
|
+
|
|
29
|
+
* Update development dependencies to commonmarker 2.8.2, html-pipeline 3.2, minitest 6, and activesupport 8.1.
|
|
30
|
+
* Require 100% measured line and branch coverage and load gem metadata without loading renderers [#2072](https://github.com/github/markup/pull/2072).
|
|
31
|
+
|
|
32
|
+
## 7.0.0 - 2026-10-15 (withdrawn)
|
|
33
|
+
|
|
34
|
+
I withdrew this release on 2026-10-16. The `v7.0.0` tag remains available for traceability.
|
|
35
|
+
|
|
36
|
+
### Breaking
|
|
37
|
+
|
|
38
|
+
* Require commonmarker 2.x when using the CommonMarker renderer; upgrade existing commonmarker 0.x installations [#2059](https://github.com/github/markup/pull/2059).
|
|
39
|
+
* Accept `VALIDATE_UTF8`, `LIBERAL_HTML_TAG`, `TABLE_PREFER_STYLE_ATTRIBUTES`, and `STRIKETHROUGH_DOUBLE_TILDE` without applying them [#2059](https://github.com/github/markup/pull/2059).
|
|
40
|
+
* Preserve soft line breaks with `NOBREAKS` instead of converting them to spaces [#2059](https://github.com/github/markup/pull/2059).
|
|
41
|
+
* Apply `HARDBREAKS` and `NOBREAKS` in their supplied order; the last flag wins, replacing the old `HARDBREAKS` precedence [#2059](https://github.com/github/markup/pull/2059).
|
|
42
|
+
|
|
43
|
+
### Bug Fixes
|
|
44
|
+
|
|
45
|
+
* Support RDoc 8 formatter initialization and declare `rdoc < 9` as a runtime dependency [#2109](https://github.com/github/markup/pull/2109), [#2104](https://github.com/github/markup/pull/2104).
|
|
46
|
+
* Restore reStructuredText section and table-of-contents anchors with docutils 0.18 and later [#2081](https://github.com/github/markup/pull/2081), [#2087](https://github.com/github/markup/pull/2087).
|
|
47
|
+
|
|
48
|
+
### Development
|
|
49
|
+
|
|
50
|
+
* Update development dependencies to commonmarker 2.8.2, html-pipeline 3.2, minitest 6, and activesupport 8.1.
|
|
51
|
+
* Require 100% measured line and branch coverage and load gem metadata without loading renderers [#2072](https://github.com/github/markup/pull/2072).
|
|
52
|
+
|
|
1
53
|
## 6.0.0 - 2026-05-04
|
|
2
54
|
|
|
3
55
|
### Breaking
|
data/README.md
CHANGED
|
@@ -21,7 +21,7 @@ you wish to run the library. You can also run `script/bootstrap` to fetch them a
|
|
|
21
21
|
|
|
22
22
|
* [.markdown, .mdown, .mkdn, .md](http://daringfireball.net/projects/markdown/) -- `gem install commonmarker` (https://github.com/gjtorikian/commonmarker)
|
|
23
23
|
* [.textile](https://textile-lang.com/) -- `gem install RedCloth` (https://github.com/jgarber/redcloth)
|
|
24
|
-
* [.rdoc](https://ruby.github.io/rdoc/) -- `gem install rdoc
|
|
24
|
+
* [.rdoc](https://ruby.github.io/rdoc/) -- `gem install rdoc`
|
|
25
25
|
* [.org](http://orgmode.org/) -- `gem install org-ruby` (https://github.com/wallyqs/org-ruby)
|
|
26
26
|
* [.creole](http://wikicreole.org/) -- `gem install creole` (https://github.com/larsch/creole)
|
|
27
27
|
* [.mediawiki, .wiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth` (https://github.com/nricciar/wikicloth)
|
|
@@ -48,6 +48,8 @@ from this directory.
|
|
|
48
48
|
Usage
|
|
49
49
|
-----
|
|
50
50
|
|
|
51
|
+
Markdown rendering supports CommonMarker 0.x and 2.x. Keep the installed version to retain that parser's option behavior. Extensions follow the installed parser; 2.x-only extensions remain unavailable with 0.x.
|
|
52
|
+
|
|
51
53
|
Basic form:
|
|
52
54
|
|
|
53
55
|
```ruby
|
|
@@ -82,6 +84,8 @@ cd script
|
|
|
82
84
|
./bootstrap
|
|
83
85
|
```
|
|
84
86
|
|
|
87
|
+
Set `COMMONMARKER_VERSION` to override the development bundle's default `~> 2.8.2` requirement. See [Testing](CONTRIBUTING.md#testing) for parser version commands.
|
|
88
|
+
|
|
85
89
|
Contributing
|
|
86
90
|
------------
|
|
87
91
|
|
data/github-markup.gemspec
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
version_file = File.expand_path("../lib/github-markup.rb", __FILE__)
|
|
2
|
+
version_match = File.read(version_file).match(/VERSION = ['"]([^'"]+)['"]/)
|
|
3
|
+
raise "Could not find VERSION in #{version_file}" unless version_match
|
|
4
|
+
version = version_match[1]
|
|
2
5
|
|
|
3
6
|
Gem::Specification.new do |s|
|
|
4
7
|
s.name = "github-markup"
|
|
5
|
-
s.version =
|
|
8
|
+
s.version = version
|
|
6
9
|
s.summary = "The code GitHub uses to render README.markup"
|
|
7
10
|
s.description = <<~DESC
|
|
8
11
|
This gem is used by GitHub to render any fancy markup such as Markdown,
|
|
@@ -20,12 +23,14 @@ Gem::Specification.new do |s|
|
|
|
20
23
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
|
21
24
|
s.require_paths = %w[lib]
|
|
22
25
|
|
|
26
|
+
s.add_dependency 'rdoc', '< 9'
|
|
27
|
+
|
|
23
28
|
s.add_development_dependency 'rake', '~> 13'
|
|
24
|
-
s.add_development_dependency 'activesupport', '~>
|
|
25
|
-
s.add_development_dependency 'minitest', '
|
|
26
|
-
s.add_development_dependency 'html-pipeline', '~>
|
|
27
|
-
s.add_development_dependency 'sanitize', '>= 4.6.3'
|
|
29
|
+
s.add_development_dependency 'activesupport', '~> 8.1.3'
|
|
30
|
+
s.add_development_dependency 'minitest', '>= 5.4.3', '~> 6.0'
|
|
31
|
+
s.add_development_dependency 'html-pipeline', '~> 3.2'
|
|
28
32
|
s.add_development_dependency 'nokogiri', '~> 1.19.2'
|
|
29
33
|
s.add_development_dependency 'nokogiri-diff', '~> 0.3.0'
|
|
30
34
|
s.add_development_dependency "github-linguist", ">= 7.1.3"
|
|
35
|
+
s.add_development_dependency 'simplecov', '~> 0.22'
|
|
31
36
|
end
|
|
@@ -5,9 +5,93 @@ module GitHub
|
|
|
5
5
|
class Markdown < Implementation
|
|
6
6
|
MARKDOWN_GEMS = {
|
|
7
7
|
"commonmarker" => proc { |content, options: {}|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
legacy_opts = options.fetch(:commonmarker_opts, [])
|
|
9
|
+
legacy_exts = options.fetch(
|
|
10
|
+
:commonmarker_exts,
|
|
11
|
+
[:tagfilter, :autolink, :table, :strikethrough],
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
unless defined?(::Commonmarker) && ::Commonmarker.respond_to?(:to_html)
|
|
15
|
+
next ::CommonMarker.render_html(content, [:GITHUB_PRE_LANG] + legacy_opts, legacy_exts)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
parse_options = {}
|
|
19
|
+
# commonmarker 2.x changes several render defaults that diverge from cmark-gfm 0.x:
|
|
20
|
+
# - hardbreaks defaults to true in 2.x but was false in 0.x.
|
|
21
|
+
# - escaped_char_spans defaults to true in 2.x and wraps backslash-escaped chars in
|
|
22
|
+
# <span data-escaped-char>; 0.x emitted bare characters.
|
|
23
|
+
# - gfm_quirks defaults to false in 2.x; 0.x (cmark-gfm) always had the quirk on,
|
|
24
|
+
# which collapses ****foo**** to <strong>foo</strong> instead of nesting.
|
|
25
|
+
# - github_pre_lang defaults to true in 2.x; set explicitly to match the legacy contract.
|
|
26
|
+
render_options = {
|
|
27
|
+
github_pre_lang: true,
|
|
28
|
+
hardbreaks: false,
|
|
29
|
+
escaped_char_spans: false,
|
|
30
|
+
gfm_quirks: true,
|
|
31
|
+
}
|
|
32
|
+
extension_options = {}
|
|
33
|
+
|
|
34
|
+
legacy_opts.each do |opt|
|
|
35
|
+
case opt
|
|
36
|
+
when :DEFAULT then nil
|
|
37
|
+
when :SOURCEPOS then render_options[:sourcepos] = true
|
|
38
|
+
when :HARDBREAKS then render_options[:hardbreaks] = true
|
|
39
|
+
when :NOBREAKS then render_options[:hardbreaks] = false
|
|
40
|
+
when :SMART then parse_options[:smart] = true
|
|
41
|
+
when :GITHUB_PRE_LANG then render_options[:github_pre_lang] = true
|
|
42
|
+
when :UNSAFE then render_options[:unsafe] = true
|
|
43
|
+
when :FOOTNOTES then extension_options[:footnotes] = true
|
|
44
|
+
when :FULL_INFO_STRING then render_options[:full_info_string] = true
|
|
45
|
+
# The legacy options below existed in cmark-gfm 0.x but have no direct commonmarker
|
|
46
|
+
# 2.x equivalent. Accept them so existing callers don't break, but they have no effect:
|
|
47
|
+
# :VALIDATE_UTF8 / :LIBERAL_HTML_TAG - enforced at the Rust type layer in 2.x.
|
|
48
|
+
# :TABLE_PREFER_STYLE_ATTRIBUTES - no 2.x render knob for inline table styles.
|
|
49
|
+
# :STRIKETHROUGH_DOUBLE_TILDE - 2.x always accepts both single and double tilde.
|
|
50
|
+
when :VALIDATE_UTF8, :LIBERAL_HTML_TAG,
|
|
51
|
+
:TABLE_PREFER_STYLE_ATTRIBUTES, :STRIKETHROUGH_DOUBLE_TILDE
|
|
52
|
+
nil
|
|
53
|
+
else
|
|
54
|
+
raise ArgumentError, "unknown commonmarker option: #{opt.inspect}"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
legacy_exts.each do |ext|
|
|
59
|
+
case ext
|
|
60
|
+
when :strikethrough, :tagfilter, :autolink, :table, :tasklist,
|
|
61
|
+
:shortcodes, :footnotes, :multiline_block_quotes,
|
|
62
|
+
:math_dollars, :math_code, :wikilinks_title_after_pipe,
|
|
63
|
+
:wikilinks_title_before_pipe, :underline, :subscript, :spoiler,
|
|
64
|
+
:greentext, :alerts, :description_lists
|
|
65
|
+
extension_options[ext] = true
|
|
66
|
+
when :header_ids
|
|
67
|
+
# header_ids takes a string prefix in 2.x rather than a boolean. An empty prefix
|
|
68
|
+
# enables anchor generation for the symbol-based commonmarker_exts option.
|
|
69
|
+
extension_options[:header_ids] = ""
|
|
70
|
+
else
|
|
71
|
+
raise ArgumentError, "unknown commonmarker extension: #{ext.inspect}"
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# CommonMarker 2.x enables more extensions by default than this wrapper does.
|
|
76
|
+
# Disable unrequested defaults to preserve the wrapper's extension choices.
|
|
77
|
+
[:strikethrough, :tagfilter, :autolink, :table, :tasklist, :shortcodes].each do |ext|
|
|
78
|
+
extension_options[ext] = false unless extension_options[ext]
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# header_ids is enabled by default in commonmarker 2.x (it injects anchor tags inside
|
|
82
|
+
# every heading). The legacy 0.x wrapper never enabled it implicitly, so disable it
|
|
83
|
+
# unless the caller explicitly requested it.
|
|
84
|
+
extension_options[:header_ids] = nil unless extension_options.key?(:header_ids)
|
|
85
|
+
|
|
86
|
+
Commonmarker.to_html(
|
|
87
|
+
content,
|
|
88
|
+
options: {
|
|
89
|
+
parse: parse_options,
|
|
90
|
+
render: render_options,
|
|
91
|
+
extension: extension_options,
|
|
92
|
+
},
|
|
93
|
+
plugins: {syntax_highlighter: nil},
|
|
94
|
+
)
|
|
11
95
|
},
|
|
12
96
|
"github/markdown" => proc { |content, options: {}|
|
|
13
97
|
GitHub::Markdown.render(content)
|
data/lib/github/markup/rdoc.rb
CHANGED
|
@@ -10,11 +10,15 @@ module GitHub
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def render(filename, content, options: {})
|
|
13
|
-
|
|
13
|
+
# RDoc 4-7 require positional Options; RDoc 8 uses keyword options.
|
|
14
|
+
# Each run covers only the installed RDoc's branch; CI tests both.
|
|
15
|
+
# :nocov:
|
|
16
|
+
if (4...8).cover?(::RDoc::VERSION.to_i)
|
|
14
17
|
h = ::RDoc::Markup::ToHtml.new(::RDoc::Options.new)
|
|
15
18
|
else
|
|
16
19
|
h = ::RDoc::Markup::ToHtml.new
|
|
17
20
|
end
|
|
21
|
+
# :nocov:
|
|
18
22
|
h.convert(content)
|
|
19
23
|
end
|
|
20
24
|
|
data/lib/github/markup.rb
CHANGED
data/lib/github/markups.rb
CHANGED
|
@@ -2,32 +2,32 @@ require "github/markup/markdown"
|
|
|
2
2
|
require "github/markup/rdoc"
|
|
3
3
|
require "shellwords"
|
|
4
4
|
|
|
5
|
-
markup_impl(::GitHub::Markups::MARKUP_MARKDOWN, ::GitHub::Markup::Markdown.new)
|
|
5
|
+
GitHub::Markup.markup_impl(::GitHub::Markups::MARKUP_MARKDOWN, ::GitHub::Markup::Markdown.new)
|
|
6
6
|
|
|
7
|
-
markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, /textile/, ["Textile"]) do |filename, content, options: {}|
|
|
7
|
+
GitHub::Markup.markup(::GitHub::Markups::MARKUP_TEXTILE, :redcloth, /textile/, ["Textile"]) do |filename, content, options: {}|
|
|
8
8
|
RedCloth.new(content).to_html
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
markup_impl(::GitHub::Markups::MARKUP_RDOC, GitHub::Markup::RDoc.new)
|
|
11
|
+
GitHub::Markup.markup_impl(::GitHub::Markups::MARKUP_RDOC, GitHub::Markup::RDoc.new)
|
|
12
12
|
|
|
13
|
-
markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', /org/, ["Org"]) do |filename, content, options: {}|
|
|
13
|
+
GitHub::Markup.markup(::GitHub::Markups::MARKUP_ORG, 'org-ruby', /org/, ["Org"]) do |filename, content, options: {}|
|
|
14
14
|
Orgmode::Parser.new(content, {
|
|
15
15
|
:allow_include_files => false,
|
|
16
16
|
:skip_syntax_highlight => true
|
|
17
17
|
}).to_html
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
markup(::GitHub::Markups::MARKUP_CREOLE, :creole, /creole/, ["Creole"]) do |filename, content, options: {}|
|
|
20
|
+
GitHub::Markup.markup(::GitHub::Markups::MARKUP_CREOLE, :creole, /creole/, ["Creole"]) do |filename, content, options: {}|
|
|
21
21
|
Creole.creolize(content)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, /mediawiki|wiki/, ["MediaWiki"]) do |filename, content, options: {}|
|
|
24
|
+
GitHub::Markup.markup(::GitHub::Markups::MARKUP_MEDIAWIKI, :wikicloth, /mediawiki|wiki/, ["MediaWiki"]) do |filename, content, options: {}|
|
|
25
25
|
wikicloth = WikiCloth::WikiCloth.new(:data => content)
|
|
26
26
|
WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS << 'tt' unless WikiCloth::WikiBuffer::HTMLElement::ESCAPED_TAGS.include?('tt')
|
|
27
27
|
wikicloth.to_html(:noedit => true)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/, ["AsciiDoc"]) do |filename, content, options: {}|
|
|
30
|
+
GitHub::Markup.markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/, ["AsciiDoc"]) do |filename, content, options: {}|
|
|
31
31
|
attributes = {
|
|
32
32
|
'showtitle' => '@',
|
|
33
33
|
'idprefix' => '',
|
|
@@ -47,7 +47,7 @@ markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/, ["A
|
|
|
47
47
|
Asciidoctor.convert(content, :safe => :secure, :attributes => attributes)
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
command(
|
|
50
|
+
GitHub::Markup.command(
|
|
51
51
|
::GitHub::Markups::MARKUP_RST,
|
|
52
52
|
"python3 #{Shellwords.escape(File.dirname(__FILE__))}/commands/rest2html",
|
|
53
53
|
/re?st(\.txt)?/,
|
|
@@ -55,5 +55,5 @@ command(
|
|
|
55
55
|
"restructuredtext"
|
|
56
56
|
)
|
|
57
57
|
|
|
58
|
-
command(::GitHub::Markups::MARKUP_POD6, :pod62html, /pod6/, ["Pod 6"], "pod6")
|
|
59
|
-
command(::GitHub::Markups::MARKUP_POD, :pod2html, /pod/, ["Pod"], "pod")
|
|
58
|
+
GitHub::Markup.command(::GitHub::Markups::MARKUP_POD6, :pod62html, /pod6/, ["Pod 6"], "pod6")
|
|
59
|
+
GitHub::Markup.command(::GitHub::Markups::MARKUP_POD, :pod2html, /pod/, ["Pod"], "pod")
|