yard-fence 0.3.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 +23 -1
- data/README.md +31 -18
- data/lib/yard/fence/version.rb +1 -1
- data/lib/yard/fence.rb +9 -8
- data.tar.gz.sig +0 -0
- metadata +4 -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,26 @@ 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
|
+
|
|
33
53
|
## [0.3.0] - 2025-11-07
|
|
34
54
|
|
|
35
55
|
- TAG: [v0.3.0][0.3.0t]
|
|
@@ -62,7 +82,9 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
62
82
|
|
|
63
83
|
- Initial release
|
|
64
84
|
|
|
65
|
-
[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
|
|
66
88
|
[0.3.0]: https://github.com/galtzo-floss/yard-fence/compare/v0.2.0...v0.3.0
|
|
67
89
|
[0.3.0t]: https://github.com/galtzo-floss/yard-fence/releases/tag/v0.3.0
|
|
68
90
|
[0.2.0]: https://github.com/galtzo-floss/yard-fence/compare/v0.1.0...v0.2.0
|
data/README.md
CHANGED
|
@@ -51,7 +51,8 @@
|
|
|
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.
|
|
@@ -61,13 +62,13 @@ Create a `.yardopts` file like this:
|
|
|
61
62
|
```text
|
|
62
63
|
--plugin fence
|
|
63
64
|
-e yard/fence/hoist.rb
|
|
64
|
-
--readme tmp/README.md
|
|
65
|
+
--readme tmp/yard-fence/README.md
|
|
65
66
|
--markup markdown
|
|
66
67
|
--output docs
|
|
67
68
|
'lib/**/*.rb'
|
|
68
69
|
-
|
|
69
|
-
'tmp/*.md'
|
|
70
|
-
'tmp/*.txt'
|
|
70
|
+
'tmp/yard-fence/*.md'
|
|
71
|
+
'tmp/yard-fence/*.txt'
|
|
71
72
|
```
|
|
72
73
|
|
|
73
74
|
See the configuration and usage sections for more details.
|
|
@@ -97,7 +98,7 @@ Compatible with MRI Ruby 3.2.0+, and concordant releases of JRuby, and TruffleRu
|
|
|
97
98
|
|
|
98
99
|
### Federated DVCS
|
|
99
100
|
|
|
100
|
-
<details>
|
|
101
|
+
<details markdown="1">
|
|
101
102
|
<summary>Find this repo on federated forges (Coming soon!)</summary>
|
|
102
103
|
|
|
103
104
|
| Federated [DVCS][💎d-in-dvcs] Repository | Status | Issues | PRs | Wiki | CI | Discussions |
|
|
@@ -115,7 +116,7 @@ Compatible with MRI Ruby 3.2.0+, and concordant releases of JRuby, and TruffleRu
|
|
|
115
116
|
|
|
116
117
|
Available as part of the Tidelift Subscription.
|
|
117
118
|
|
|
118
|
-
<details>
|
|
119
|
+
<details markdown="1">
|
|
119
120
|
<summary>Need enterprise-level guarantees?</summary>
|
|
120
121
|
|
|
121
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.
|
|
@@ -139,7 +140,18 @@ Alternatively:
|
|
|
139
140
|
Install the gem and add to the application's Gemfile by executing:
|
|
140
141
|
|
|
141
142
|
```console
|
|
142
|
-
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
|
|
143
155
|
```
|
|
144
156
|
|
|
145
157
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
@@ -150,7 +162,7 @@ gem install yard-fence
|
|
|
150
162
|
|
|
151
163
|
### 🔒 Secure Installation
|
|
152
164
|
|
|
153
|
-
<details>
|
|
165
|
+
<details markdown="1">
|
|
154
166
|
<summary>For Medium or High Security Installations</summary>
|
|
155
167
|
|
|
156
168
|
This gem is cryptographically signed, and has verifiable [SHA-256 and SHA-512][💎SHA_checksums] checksums by
|
|
@@ -185,24 +197,25 @@ NOTE: Be prepared to track down certs for signed gems and add them the same way
|
|
|
185
197
|
|
|
186
198
|
## ⚙️ Configuration
|
|
187
199
|
|
|
188
|
-
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.
|
|
189
201
|
|
|
190
202
|
Recommended .yardopts (noise‑free):
|
|
191
203
|
|
|
192
204
|
```text
|
|
193
205
|
--plugin fence
|
|
194
206
|
-e yard/fence/hoist.rb
|
|
195
|
-
--readme tmp/README.md
|
|
207
|
+
--readme tmp/yard-fence/README.md
|
|
196
208
|
--markup markdown
|
|
197
209
|
--output docs
|
|
198
210
|
'lib/**/*.rb'
|
|
199
211
|
-
|
|
200
|
-
'tmp/*.md'
|
|
201
|
-
'tmp/*.txt'
|
|
212
|
+
'tmp/yard-fence/*.md'
|
|
213
|
+
'tmp/yard-fence/*.txt'
|
|
202
214
|
```
|
|
203
215
|
|
|
204
|
-
Why tmp/?
|
|
205
|
-
|
|
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.
|
|
206
219
|
|
|
207
220
|
## 🔧 Basic Usage
|
|
208
221
|
|
|
@@ -212,8 +225,8 @@ CLI example that would be similar to what is accomplished by the `.yardopts` fro
|
|
|
212
225
|
yard doc \
|
|
213
226
|
--plugin fence \
|
|
214
227
|
-e yard/fence/hoist.rb \
|
|
215
|
-
--readme tmp/README.md \
|
|
216
|
-
lib/**/*.rb - tmp/*.md tmp/*.txt
|
|
228
|
+
--readme tmp/yard-fence/README.md \
|
|
229
|
+
lib/**/*.rb - tmp/yard-fence/*.md tmp/yard-fence/*.txt
|
|
217
230
|
```
|
|
218
231
|
|
|
219
232
|
## 🦷 FLOSS Funding
|
|
@@ -344,10 +357,10 @@ the [Pessimistic Version Constraint][📌pvc] with two digits of precision.
|
|
|
344
357
|
For example:
|
|
345
358
|
|
|
346
359
|
```ruby
|
|
347
|
-
spec.add_dependency("yard-fence", "~>
|
|
360
|
+
spec.add_dependency("yard-fence", "~> 0.4")
|
|
348
361
|
```
|
|
349
362
|
|
|
350
|
-
<details>
|
|
363
|
+
<details markdown="1">
|
|
351
364
|
<summary>📌 Is "Platform Support" part of the public API? More details inside.</summary>
|
|
352
365
|
|
|
353
366
|
SemVer should, IMO, but doesn't explicitly, say that dropping support for specific Platforms
|
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
|
|
@@ -316,10 +316,10 @@ licenses:
|
|
|
316
316
|
- MIT
|
|
317
317
|
metadata:
|
|
318
318
|
homepage_uri: https://yard-fence.galtzo.com/
|
|
319
|
-
source_code_uri: https://github.com/galtzo-floss/yard-fence/tree/v0.
|
|
320
|
-
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
|
|
321
321
|
bug_tracker_uri: https://github.com/galtzo-floss/yard-fence/issues
|
|
322
|
-
documentation_uri: https://www.rubydoc.info/gems/yard-fence/0.
|
|
322
|
+
documentation_uri: https://www.rubydoc.info/gems/yard-fence/0.4.0
|
|
323
323
|
funding_uri: https://github.com/sponsors/pboling
|
|
324
324
|
wiki_uri: https://github.com/galtzo-floss/yard-fence/wiki
|
|
325
325
|
news_uri: https://www.railsbling.com/tags/yard-fence
|
metadata.gz.sig
CHANGED
|
Binary file
|