yard-fence 0.1.0 → 0.3.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 +34 -0
- data/README.md +20 -4
- data/lib/yard/fence/hoist.rb +9 -0
- data/lib/yard/fence/version.rb +1 -1
- data/lib/yard/fence.rb +28 -5
- data/sig/kramdown.rbs +1 -1
- data/sig/yard/fence.rbs +22 -5
- 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: 5baded4374cd088861f834e9979c206e08dac16af4c52fdbf3d28ea1e7ce8c58
|
|
4
|
+
data.tar.gz: bf14fe77229b435e7361883d6dd6128bcff08f58ed8a7742fb88eb9223148a2d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0c10875a2282e3e6613bdc39bcf37b5aa3507489a5f94406ded819765e3a9feb3ab1581c8a9a3e9c4b11e22564bafb0c7f137db6f7f038248e4d59827080cbdf
|
|
7
|
+
data.tar.gz: fae576e37e8f9c840bb5e6c772cfdfa7e8eb5e3a065ae9c3deda8d23860595a6827f52f529ae7d12944be2321d4fe0a74753e752505b8b2574a4df49704f1803
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/CHANGELOG.md
CHANGED
|
@@ -30,6 +30,40 @@ Please file a bug if you notice a violation of semantic versioning.
|
|
|
30
30
|
|
|
31
31
|
### Security
|
|
32
32
|
|
|
33
|
+
## [0.3.0] - 2025-11-07
|
|
34
|
+
|
|
35
|
+
- TAG: [v0.3.0][0.3.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
|
+
- yard/fence/hoist.rb: Hoisting the customized GFM kramdown parser
|
|
43
|
+
|
|
44
|
+
## [0.2.0] - 2025-11-07
|
|
45
|
+
|
|
46
|
+
- TAG: [v0.2.0][0.2.0t]
|
|
47
|
+
- COVERAGE: 96.43% -- 81/84 lines in 4 files
|
|
48
|
+
- BRANCH COVERAGE: 93.75% -- 15/16 branches in 4 files
|
|
49
|
+
- 29.17% documented
|
|
50
|
+
|
|
51
|
+
### Added
|
|
52
|
+
|
|
53
|
+
- Up to 96% lines / 93% branches test coverage
|
|
54
|
+
|
|
55
|
+
### Fixed
|
|
56
|
+
|
|
57
|
+
- handling of optional dependencies
|
|
58
|
+
- kramdown
|
|
59
|
+
- kramdown-parser-gfm
|
|
60
|
+
|
|
33
61
|
## [0.1.0] - 2025-11-06
|
|
34
62
|
|
|
35
63
|
- Initial release
|
|
64
|
+
|
|
65
|
+
[Unreleased]: https://github.com/galtzo-floss/yard-fence/compare/v0.3.0...HEAD
|
|
66
|
+
[0.3.0]: https://github.com/galtzo-floss/yard-fence/compare/v0.2.0...v0.3.0
|
|
67
|
+
[0.3.0t]: https://github.com/galtzo-floss/yard-fence/releases/tag/v0.3.0
|
|
68
|
+
[0.2.0]: https://github.com/galtzo-floss/yard-fence/compare/v0.1.0...v0.2.0
|
|
69
|
+
[0.2.0t]: https://github.com/galtzo-floss/yard-fence/releases/tag/v0.2.0
|
data/README.md
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
|
|
49
49
|
## 🌻 Synopsis
|
|
50
50
|
|
|
51
|
-
A brace converter for the markdown fences in your YARD docs.
|
|
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
|
- Preprocesses top-level README and other `.md`/`.txt` files into `tmp/` replacing ASCII braces inside fenced code blocks, inline code spans, and simple placeholders like `{issuer}` or `{{TOKEN}}` with visually identical fullwidth braces.
|
|
@@ -56,6 +56,22 @@ Just the important bits:
|
|
|
56
56
|
- Prioritizes Kramdown's GFM parser so tables and fenced code blocks render correctly.
|
|
57
57
|
- After YARD finishes generating HTML, restores fullwidth braces back to normal ASCII braces so code examples are copy‑pastable.
|
|
58
58
|
|
|
59
|
+
Create a `.yardopts` file like this:
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
--plugin fence
|
|
63
|
+
-e yard/fence/hoist.rb
|
|
64
|
+
--readme tmp/README.md
|
|
65
|
+
--markup markdown
|
|
66
|
+
--output docs
|
|
67
|
+
'lib/**/*.rb'
|
|
68
|
+
-
|
|
69
|
+
'tmp/*.md'
|
|
70
|
+
'tmp/*.txt'
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
See the configuration and usage sections for more details.
|
|
74
|
+
|
|
59
75
|
## 💡 Info you can shake a stick at
|
|
60
76
|
|
|
61
77
|
| Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
|
|
@@ -175,7 +191,7 @@ Recommended .yardopts (noise‑free):
|
|
|
175
191
|
|
|
176
192
|
```text
|
|
177
193
|
--plugin fence
|
|
178
|
-
-e
|
|
194
|
+
-e yard/fence/hoist.rb
|
|
179
195
|
--readme tmp/README.md
|
|
180
196
|
--markup markdown
|
|
181
197
|
--output docs
|
|
@@ -195,7 +211,7 @@ CLI example that would be similar to what is accomplished by the `.yardopts` fro
|
|
|
195
211
|
```bash
|
|
196
212
|
yard doc \
|
|
197
213
|
--plugin fence \
|
|
198
|
-
-e
|
|
214
|
+
-e yard/fence/hoist.rb \
|
|
199
215
|
--readme tmp/README.md \
|
|
200
216
|
lib/**/*.rb - tmp/*.md tmp/*.txt
|
|
201
217
|
```
|
|
@@ -557,7 +573,7 @@ Thanks for RTFM. ☺️
|
|
|
557
573
|
[📌gitmoji]: https://gitmoji.dev
|
|
558
574
|
[📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
|
|
559
575
|
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
560
|
-
[🧮kloc-img]: https://img.shields.io/badge/KLOC-
|
|
576
|
+
[🧮kloc-img]: https://img.shields.io/badge/KLOC-0.084-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
|
|
561
577
|
[🔐security]: SECURITY.md
|
|
562
578
|
[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
|
|
563
579
|
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
|
@@ -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
|
@@ -43,7 +43,19 @@ require "version_gem"
|
|
|
43
43
|
|
|
44
44
|
# includes gem files
|
|
45
45
|
require_relative "fence/version"
|
|
46
|
-
|
|
46
|
+
begin
|
|
47
|
+
require_relative "fence/kramdown_gfm_document"
|
|
48
|
+
# :nocov:
|
|
49
|
+
# Not covering, because kramdown support is tested, so this rescue is not hit in test runs.
|
|
50
|
+
rescue LoadError => error
|
|
51
|
+
# check the error message, and re-raise if not what is expected
|
|
52
|
+
if error.message.include?("kramdown")
|
|
53
|
+
warn("Yard::Fence: Kramdown GFM provider not loaded: #{error.class}: #{error.message}") if ENV.fetch("YARD_DEBUG", "false").casecmp?("true")
|
|
54
|
+
else
|
|
55
|
+
raise error
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
# :nocov:
|
|
47
59
|
|
|
48
60
|
module Yard
|
|
49
61
|
module Fence
|
|
@@ -57,7 +69,10 @@ module Yard
|
|
|
57
69
|
SINGLE_BRACE_PLACEHOLDER_REGEX = /{([A-Za-z0-9_:\-]+)}/
|
|
58
70
|
|
|
59
71
|
class Error < StandardError; end
|
|
72
|
+
# :nocov:
|
|
73
|
+
# This is a runtime sanity check to ensure our fullwidth braces differ from ASCII braces.
|
|
60
74
|
raise Error, "ASCII braces are not the same as Unicode Fullwidth braces" if ASCII_BRACES == FULLWIDTH_BRACES
|
|
75
|
+
# :nocov:
|
|
61
76
|
|
|
62
77
|
module_function
|
|
63
78
|
|
|
@@ -139,6 +154,12 @@ module Yard
|
|
|
139
154
|
# require warnings when YARD is in the middle of loading itself. Call this
|
|
140
155
|
# from a file loaded via .yardopts (e.g. `-e 'require "yard/fence/kramdown_gfm"; Yard::Fence.use_kramdown_gfm!'`).
|
|
141
156
|
def use_kramdown_gfm!
|
|
157
|
+
# :nocov:
|
|
158
|
+
# Not covering, because kramdown support is tested, so this rescue is not hit in test runs.
|
|
159
|
+
unless defined?(Yard::Fence::KramdownGfmDocument)
|
|
160
|
+
raise Error, "Yard::Fence: Kramdown GFM provider not loaded. Add kramdown and kramdown-parser-gfm to your Gemfile."
|
|
161
|
+
end
|
|
162
|
+
# :nocov:
|
|
142
163
|
providers = ::YARD::Templates::Helpers::MarkupHelper::MARKUP_PROVIDERS[:markdown]
|
|
143
164
|
providers.unshift(KRAMDOWN_PROVIDER)
|
|
144
165
|
providers.uniq! { |p| [p[:lib].to_s, p[:const].to_s] }
|
|
@@ -162,8 +183,10 @@ Yard::Fence::Version.class_eval do
|
|
|
162
183
|
extend VersionGem::Basic
|
|
163
184
|
end
|
|
164
185
|
|
|
165
|
-
|
|
166
|
-
#
|
|
167
|
-
|
|
168
|
-
|
|
186
|
+
unless ENV["YARD_FENCE_SKIP_AT_EXIT"] == "1"
|
|
187
|
+
# After YARD completes, restore ASCII braces in generated HTML docs.
|
|
188
|
+
# This guarantees the published docs (docs/*.html) show and copy normal { }.
|
|
189
|
+
at_exit do
|
|
190
|
+
Yard::Fence.postprocess_html_docs
|
|
191
|
+
end
|
|
169
192
|
end
|
data/sig/kramdown.rbs
CHANGED
data/sig/yard/fence.rbs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
module Yard
|
|
2
2
|
module Fence
|
|
3
|
-
# Constants
|
|
3
|
+
# Constants (refined literal types where possible)
|
|
4
4
|
VERSION: String
|
|
5
|
-
ASCII_BRACES:
|
|
6
|
-
FULLWIDTH_BRACES:
|
|
7
|
-
KRAMDOWN_PROVIDER:
|
|
5
|
+
ASCII_BRACES: "{}"
|
|
6
|
+
FULLWIDTH_BRACES: "{}"
|
|
7
|
+
KRAMDOWN_PROVIDER: { lib: Symbol, const: String }
|
|
8
8
|
GLOB_PATTERN: String
|
|
9
9
|
TRIPLE_TICK_FENCE: ::Regexp
|
|
10
10
|
INLINE_TICK_FENCE: ::Regexp
|
|
@@ -15,16 +15,33 @@ module Yard
|
|
|
15
15
|
class Error < ::StandardError
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
# Module functions
|
|
18
|
+
# Module functions (available both as singleton and instance via module_function)
|
|
19
19
|
def self.fullwidth_braces: (String str) -> String
|
|
20
|
+
def fullwidth_braces: (String str) -> String
|
|
21
|
+
|
|
20
22
|
def self.sanitize_inline_code: (String line) -> String
|
|
23
|
+
def sanitize_inline_code: (String line) -> String
|
|
24
|
+
|
|
21
25
|
def self.sanitize_fenced_blocks: (String text) -> String
|
|
26
|
+
def sanitize_fenced_blocks: (String text) -> String
|
|
27
|
+
|
|
28
|
+
# Accept any object; if String returns String, otherwise returns original (untyped)
|
|
22
29
|
def self.sanitize_text: (String text) -> String
|
|
23
30
|
| (untyped text) -> untyped
|
|
31
|
+
def sanitize_text: (String text) -> String
|
|
32
|
+
| (untyped text) -> untyped
|
|
33
|
+
|
|
24
34
|
def self.prepare_tmp_files: () -> void
|
|
35
|
+
def prepare_tmp_files: () -> void
|
|
36
|
+
|
|
25
37
|
def self.restore_ascii_braces_in_html_file: (String html_filepath) -> void
|
|
38
|
+
def restore_ascii_braces_in_html_file: (String html_filepath) -> void
|
|
39
|
+
|
|
26
40
|
def self.postprocess_html_docs: () -> void
|
|
41
|
+
def postprocess_html_docs: () -> void
|
|
42
|
+
|
|
27
43
|
def self.use_kramdown_gfm!: () -> bool
|
|
44
|
+
def use_kramdown_gfm!: () -> bool
|
|
28
45
|
|
|
29
46
|
module Version
|
|
30
47
|
VERSION: String
|
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.3.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.3.0
|
|
320
|
+
changelog_uri: https://github.com/galtzo-floss/yard-fence/blob/v0.3.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.3.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
|