yard-fence 0.2.0 → 0.4.0
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
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +36 -1
- data/README.md +46 -17
- data/lib/yard/fence/hoist.rb +9 -0
- data/lib/yard/fence/version.rb +1 -1
- data/lib/yard/fence.rb +9 -8
- data.tar.gz.sig +0 -0
- metadata +5 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aaa318b924e8efbaddbb3666df3f71157678a5fbab11972f51550ecd48f4ddb2
|
|
4
|
+
data.tar.gz: af4bb34d3b799695511f5b880aa1fffa7d9765dcb71a8c5c780bfbd53f5d9f35
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c59ecea9ee908fe804879b2197ab6047769d70a2256e69522afff4069ad73e95b48f370f0ab9a1827dc4f955e2e1f3ded8c7017da27869c0cb2b262e986f910c
|
|
7
|
+
data.tar.gz: 4ed6d00979a897c5ced52a0c72ae108c2eb05a29be9e73b9e0dd5bbc1546e80c6f54a1d780460b4a41268e0dcac27cff10142e70fb7826755f8ba511a6715508
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,37 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
30
30
|
|
|
31
31
|
### Security
|
|
32
32
|
|
|
33
|
+
## [0.4.0] - 2025-11-07
|
|
34
|
+
|
|
35
|
+
- TAG: [v0.4.0][0.4.0t]
|
|
36
|
+
- COVERAGE: 96.43% -- 81/84 lines in 4 files
|
|
37
|
+
- BRANCH COVERAGE: 93.75% -- 15/16 branches in 4 files
|
|
38
|
+
- 29.17% documented
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
|
|
42
|
+
- Docs: Document importance of `require: false` in `Gemfile` for this gem
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- Docs: Improved markdown syntax in README.md for Kramdown => HTML
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
|
|
50
|
+
- Use namespaced directory in `tmp/` (`tmp/yard-fence`)
|
|
51
|
+
- avoids polluting, and pollution from, other garbage in `tmp/`
|
|
52
|
+
|
|
53
|
+
## [0.3.0] - 2025-11-07
|
|
54
|
+
|
|
55
|
+
- TAG: [v0.3.0][0.3.0t]
|
|
56
|
+
- COVERAGE: 96.43% -- 81/84 lines in 4 files
|
|
57
|
+
- BRANCH COVERAGE: 93.75% -- 15/16 branches in 4 files
|
|
58
|
+
- 29.17% documented
|
|
59
|
+
|
|
60
|
+
### Added
|
|
61
|
+
|
|
62
|
+
- yard/fence/hoist.rb: Hoisting the customized GFM kramdown parser
|
|
63
|
+
|
|
33
64
|
## [0.2.0] - 2025-11-07
|
|
34
65
|
|
|
35
66
|
- TAG: [v0.2.0][0.2.0t]
|
|
@@ -51,6 +82,10 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
51
82
|
|
|
52
83
|
- Initial release
|
|
53
84
|
|
|
54
|
-
[Unreleased]: https://github.com/galtzo-floss/yard-fence/compare/v0.
|
|
85
|
+
[Unreleased]: https://github.com/galtzo-floss/yard-fence/compare/v0.4.0...HEAD
|
|
86
|
+
[0.4.0]: https://github.com/galtzo-floss/yard-fence/compare/v0.3.0...v0.4.0
|
|
87
|
+
[0.4.0t]: https://github.com/galtzo-floss/yard-fence/releases/tag/v0.4.0
|
|
88
|
+
[0.3.0]: https://github.com/galtzo-floss/yard-fence/compare/v0.2.0...v0.3.0
|
|
89
|
+
[0.3.0t]: https://github.com/galtzo-floss/yard-fence/releases/tag/v0.3.0
|
|
55
90
|
[0.2.0]: https://github.com/galtzo-floss/yard-fence/compare/v0.1.0...v0.2.0
|
|
56
91
|
[0.2.0t]: https://github.com/galtzo-floss/yard-fence/releases/tag/v0.2.0
|
data/README.md
CHANGED
|
@@ -51,11 +51,28 @@
|
|
|
51
51
|
A brace converter for the markdown fences in your YARD docs to prevent the `InvalidLink` warning.
|
|
52
52
|
|
|
53
53
|
Just the important bits:
|
|
54
|
-
|
|
54
|
+
|
|
55
|
+
- Preprocesses top-level README and other `.md`/`.txt` files into `tmp/yard-fence/` replacing ASCII braces inside fenced code blocks, inline code spans, and simple placeholders like `{issuer}` or `{{TOKEN}}` with visually identical fullwidth braces.
|
|
55
56
|
- This prevents YARD from emitting `InvalidLink` warnings.
|
|
56
57
|
- Prioritizes Kramdown's GFM parser so tables and fenced code blocks render correctly.
|
|
57
58
|
- After YARD finishes generating HTML, restores fullwidth braces back to normal ASCII braces so code examples are copy‑pastable.
|
|
58
59
|
|
|
60
|
+
Create a `.yardopts` file like this:
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
--plugin fence
|
|
64
|
+
-e yard/fence/hoist.rb
|
|
65
|
+
--readme tmp/yard-fence/README.md
|
|
66
|
+
--markup markdown
|
|
67
|
+
--output docs
|
|
68
|
+
'lib/**/*.rb'
|
|
69
|
+
-
|
|
70
|
+
'tmp/yard-fence/*.md'
|
|
71
|
+
'tmp/yard-fence/*.txt'
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
See the configuration and usage sections for more details.
|
|
75
|
+
|
|
59
76
|
## 💡 Info you can shake a stick at
|
|
60
77
|
|
|
61
78
|
| Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
|
|
@@ -81,7 +98,7 @@ Compatible with MRI Ruby 3.2.0+, and concordant releases of JRuby, and TruffleRu
|
|
|
81
98
|
|
|
82
99
|
### Federated DVCS
|
|
83
100
|
|
|
84
|
-
<details>
|
|
101
|
+
<details markdown="1">
|
|
85
102
|
<summary>Find this repo on federated forges (Coming soon!)</summary>
|
|
86
103
|
|
|
87
104
|
| Federated [DVCS][💎d-in-dvcs] Repository | Status | Issues | PRs | Wiki | CI | Discussions |
|
|
@@ -99,7 +116,7 @@ Compatible with MRI Ruby 3.2.0+, and concordant releases of JRuby, and TruffleRu
|
|
|
99
116
|
|
|
100
117
|
Available as part of the Tidelift Subscription.
|
|
101
118
|
|
|
102
|
-
<details>
|
|
119
|
+
<details markdown="1">
|
|
103
120
|
<summary>Need enterprise-level guarantees?</summary>
|
|
104
121
|
|
|
105
122
|
The maintainers of this and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.
|
|
@@ -123,7 +140,18 @@ Alternatively:
|
|
|
123
140
|
Install the gem and add to the application's Gemfile by executing:
|
|
124
141
|
|
|
125
142
|
```console
|
|
126
|
-
bundle add yard-fence
|
|
143
|
+
bundle add yard-fence --require false
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
NOTE: if you add it directly to your Gemfile,
|
|
147
|
+
be sure to include `require: false` so bundler doesn't load it when bootstrapping.
|
|
148
|
+
This is important because this gem has a global `at_exit` callback that only makes sense to run after yard runs.
|
|
149
|
+
As such this gem should only be loaded by YARD itself via the `--plugin fence` option.
|
|
150
|
+
|
|
151
|
+
Example:
|
|
152
|
+
|
|
153
|
+
```ruby
|
|
154
|
+
gem "yard-fence", "~> 0.3", require: false
|
|
127
155
|
```
|
|
128
156
|
|
|
129
157
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
@@ -134,7 +162,7 @@ gem install yard-fence
|
|
|
134
162
|
|
|
135
163
|
### 🔒 Secure Installation
|
|
136
164
|
|
|
137
|
-
<details>
|
|
165
|
+
<details markdown="1">
|
|
138
166
|
<summary>For Medium or High Security Installations</summary>
|
|
139
167
|
|
|
140
168
|
This gem is cryptographically signed, and has verifiable [SHA-256 and SHA-512][💎SHA_checksums] checksums by
|
|
@@ -169,24 +197,25 @@ NOTE: Be prepared to track down certs for signed gems and add them the same way
|
|
|
169
197
|
|
|
170
198
|
## ⚙️ Configuration
|
|
171
199
|
|
|
172
|
-
Yard::Fence writes sanitized copies of top‑level Markdown/TXT into tmp/ at load time. To avoid YARD parsing the unsanitized originals, point YARD at the tmp/ copies.
|
|
200
|
+
NOTE: `Yard::Fence` writes sanitized copies of top‑level Markdown/TXT into `tmp/yard-fence/` at load time. To avoid YARD parsing the unsanitized originals, point YARD at the `tmp/yard-fence/` copies.
|
|
173
201
|
|
|
174
202
|
Recommended .yardopts (noise‑free):
|
|
175
203
|
|
|
176
204
|
```text
|
|
177
205
|
--plugin fence
|
|
178
|
-
-e
|
|
179
|
-
--readme tmp/README.md
|
|
206
|
+
-e yard/fence/hoist.rb
|
|
207
|
+
--readme tmp/yard-fence/README.md
|
|
180
208
|
--markup markdown
|
|
181
209
|
--output docs
|
|
182
210
|
'lib/**/*.rb'
|
|
183
211
|
-
|
|
184
|
-
'tmp/*.md'
|
|
185
|
-
'tmp/*.txt'
|
|
212
|
+
'tmp/yard-fence/*.md'
|
|
213
|
+
'tmp/yard-fence/*.txt'
|
|
186
214
|
```
|
|
187
215
|
|
|
188
|
-
Why tmp/?
|
|
189
|
-
|
|
216
|
+
Why tmp/yard-fence/?
|
|
217
|
+
|
|
218
|
+
- The plugin converts ASCII `{ }` to fullwidth `{ }` only in `tmp/yard-fence/` so YARD won’t treat brace content as reference tags and emit `InvalidLink` warnings. After docs are generated, the HTML is restored back to normal ASCII braces for easy copy/paste.
|
|
190
219
|
|
|
191
220
|
## 🔧 Basic Usage
|
|
192
221
|
|
|
@@ -195,9 +224,9 @@ CLI example that would be similar to what is accomplished by the `.yardopts` fro
|
|
|
195
224
|
```bash
|
|
196
225
|
yard doc \
|
|
197
226
|
--plugin fence \
|
|
198
|
-
-e
|
|
199
|
-
--readme tmp/README.md \
|
|
200
|
-
lib/**/*.rb - tmp/*.md tmp/*.txt
|
|
227
|
+
-e yard/fence/hoist.rb \
|
|
228
|
+
--readme tmp/yard-fence/README.md \
|
|
229
|
+
lib/**/*.rb - tmp/yard-fence/*.md tmp/yard-fence/*.txt
|
|
201
230
|
```
|
|
202
231
|
|
|
203
232
|
## 🦷 FLOSS Funding
|
|
@@ -328,10 +357,10 @@ the [Pessimistic Version Constraint][📌pvc] with two digits of precision.
|
|
|
328
357
|
For example:
|
|
329
358
|
|
|
330
359
|
```ruby
|
|
331
|
-
spec.add_dependency("yard-fence", "~>
|
|
360
|
+
spec.add_dependency("yard-fence", "~> 0.4")
|
|
332
361
|
```
|
|
333
362
|
|
|
334
|
-
<details>
|
|
363
|
+
<details markdown="1">
|
|
335
364
|
<summary>📌 Is "Platform Support" part of the public API? More details inside.</summary>
|
|
336
365
|
|
|
337
366
|
SemVer should, IMO, but doesn't explicitly, say that dropping support for specific Platforms
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
if defined?(Yard::Fence) && Yard::Fence.respond_to?(:use_kramdown_gfm!)
|
|
2
|
+
if Yard::Fence.use_kramdown_gfm!
|
|
3
|
+
puts "[yard/fence/hoist] Kramdown GFM provider registered"
|
|
4
|
+
else
|
|
5
|
+
warn "[yard/fence/hoist] Kramdown GFM provider registration failed"
|
|
6
|
+
end
|
|
7
|
+
else
|
|
8
|
+
warn("[yard/fence/hoist] Yard::Fence.use_kramdown_gfm! not available; skipping")
|
|
9
|
+
end
|
data/lib/yard/fence/version.rb
CHANGED
data/lib/yard/fence.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Prepare sanitized copies of Markdown/TXT files in tmp/ for YARD consumption.
|
|
3
|
+
# Prepare sanitized copies of Markdown/TXT files in tmp/yard-fence/ for YARD consumption.
|
|
4
4
|
#
|
|
5
5
|
# Why this exists
|
|
6
6
|
# - YARD treats any `{…}` sequence in extra files (like README.md) as a potential link
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
# no backslash escapes sprinkled throughout examples).
|
|
15
15
|
# - We need YARD to stop interpreting code-fenced braces as links.
|
|
16
16
|
#
|
|
17
|
-
# Strategy (tmp/ preprocessor)
|
|
18
|
-
# - At doc build time, copy top-level *.md/*.txt into tmp/ and transform only the risky
|
|
17
|
+
# Strategy (tmp/yard-fence/ preprocessor)
|
|
18
|
+
# - At doc build time, copy top-level *.md/*.txt into tmp/yard-fence/ and transform only the risky
|
|
19
19
|
# brace pairs in contexts YARD misinterprets:
|
|
20
20
|
# * inside triple‑backtick fenced code blocks
|
|
21
21
|
# * inside single‑backtick inline code spans
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
#
|
|
29
29
|
# Key lines to see:
|
|
30
30
|
# - Transform to fullwidth: str.tr('{}', '{}')
|
|
31
|
-
# This replaces ASCII { and } with their fullwidth Unicode counterparts in sanitized tmp files.
|
|
31
|
+
# This replaces ASCII { and } with their fullwidth Unicode counterparts in sanitized tmp/yard-fence files.
|
|
32
32
|
# - Restore to ASCII (HTML): out = src.tr('{}', '{}')
|
|
33
33
|
# This runs after docs are generated and rewrites the HTML contents back to normal { and }.
|
|
34
34
|
#
|
|
@@ -84,6 +84,7 @@ module Yard
|
|
|
84
84
|
|
|
85
85
|
# Escape braces inside inline `code` spans only.
|
|
86
86
|
def sanitize_inline_code(line)
|
|
87
|
+
# Use $1 because the block parameter (_) is the matched substring, not a MatchData object.
|
|
87
88
|
line.gsub(INLINE_TICK_FENCE) { |_| "`#{fullwidth_braces($1)}`" }
|
|
88
89
|
end
|
|
89
90
|
|
|
@@ -114,10 +115,10 @@ module Yard
|
|
|
114
115
|
sanitize_fenced_blocks(text)
|
|
115
116
|
end
|
|
116
117
|
|
|
117
|
-
# Copy top-level *.md/*.txt into tmp/ with the above sanitization applied.
|
|
118
|
+
# Copy top-level *.md/*.txt into tmp/yard-fence/ with the above sanitization applied.
|
|
118
119
|
def prepare_tmp_files
|
|
119
120
|
root = Dir.pwd
|
|
120
|
-
outdir = File.join(root, "tmp")
|
|
121
|
+
outdir = File.join(root, "tmp", "yard-fence")
|
|
121
122
|
FileUtils.mkdir_p(outdir)
|
|
122
123
|
|
|
123
124
|
candidates = Dir.glob(File.join(root, GLOB_PATTERN))
|
|
@@ -170,11 +171,11 @@ module Yard
|
|
|
170
171
|
end
|
|
171
172
|
end
|
|
172
173
|
|
|
173
|
-
# Execute at load-time so files exist before YARD scans tmp/*.md
|
|
174
|
+
# Execute at load-time so files exist before YARD scans tmp/yard-fence/*.md
|
|
174
175
|
begin
|
|
175
176
|
Yard::Fence.prepare_tmp_files
|
|
176
177
|
rescue => e
|
|
177
|
-
warn("Yard::Fence: failed to prepare tmp files: #{e.class}: #{e.message}")
|
|
178
|
+
warn("Yard::Fence: failed to prepare tmp/yard-fence files: #{e.class}: #{e.message}")
|
|
178
179
|
end
|
|
179
180
|
end
|
|
180
181
|
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yard-fence
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter H. Boling
|
|
@@ -306,6 +306,7 @@ files:
|
|
|
306
306
|
- SECURITY.md
|
|
307
307
|
- lib/yard-fence.rb
|
|
308
308
|
- lib/yard/fence.rb
|
|
309
|
+
- lib/yard/fence/hoist.rb
|
|
309
310
|
- lib/yard/fence/kramdown_gfm_document.rb
|
|
310
311
|
- lib/yard/fence/version.rb
|
|
311
312
|
- sig/kramdown.rbs
|
|
@@ -315,10 +316,10 @@ licenses:
|
|
|
315
316
|
- MIT
|
|
316
317
|
metadata:
|
|
317
318
|
homepage_uri: https://yard-fence.galtzo.com/
|
|
318
|
-
source_code_uri: https://github.com/galtzo-floss/yard-fence/tree/v0.
|
|
319
|
-
changelog_uri: https://github.com/galtzo-floss/yard-fence/blob/v0.
|
|
319
|
+
source_code_uri: https://github.com/galtzo-floss/yard-fence/tree/v0.4.0
|
|
320
|
+
changelog_uri: https://github.com/galtzo-floss/yard-fence/blob/v0.4.0/CHANGELOG.md
|
|
320
321
|
bug_tracker_uri: https://github.com/galtzo-floss/yard-fence/issues
|
|
321
|
-
documentation_uri: https://www.rubydoc.info/gems/yard-fence/0.
|
|
322
|
+
documentation_uri: https://www.rubydoc.info/gems/yard-fence/0.4.0
|
|
322
323
|
funding_uri: https://github.com/sponsors/pboling
|
|
323
324
|
wiki_uri: https://github.com/galtzo-floss/yard-fence/wiki
|
|
324
325
|
news_uri: https://www.railsbling.com/tags/yard-fence
|
metadata.gz.sig
CHANGED
|
Binary file
|