markdowndocs 0.2.0 → 0.2.2
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/CHANGELOG.md +19 -0
- data/app/assets/javascripts/markdowndocs/application.js +11 -0
- data/config/importmap.rb +9 -0
- data/lib/generators/markdowndocs/install/install_generator.rb +18 -0
- data/lib/markdowndocs/engine.rb +21 -0
- data/lib/markdowndocs/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a6f2f9ae54ee9769434428aec5808626c4bcc08a55137c339c9310df30fe5973
|
|
4
|
+
data.tar.gz: c8e029017e1b6739c2b3f2740a016bdf42ff02e87d5935330601ea5f6bd2fb0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 751e5771036b40187003bbbdeaa0fc9ed27142b9d3e542a1e712d74b9f02ac174e82ae8f9ebb1a32b29b42fe3083c2990c746a92aac04fb50a31914a638bb66d
|
|
7
|
+
data.tar.gz: 22e8544a817e4402d071163c5fc809f316d90a13f7239f50d37e6d3756fd182535f869af85f34d594b94a566445ca799092fc2f0e6558b088b7749384a50fcf7
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,23 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.2.2] - 2026-03-18
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Stimulus controllers now auto-register via a single JS entry point (`import "markdowndocs"`), following the ActionText/Trix pattern. Host apps no longer need to pin individual controllers in their importmap.
|
|
13
|
+
- Install generator adds `import "markdowndocs"` to the host app's `application.js` instead of injecting importmap pins.
|
|
14
|
+
- Added engine and generator specs for the new JS registration flow.
|
|
15
|
+
|
|
16
|
+
## [0.2.1] - 2026-02-21
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Stimulus controllers and vendored minisearch now auto-register with the host app's importmap. Previously, host apps had to manually add pins to `config/importmap.rb`.
|
|
21
|
+
- Engine now registers `app/assets/javascripts` in the asset pipeline paths so Propshaft/Sprockets can serve the JS files.
|
|
22
|
+
- Install generator now injects importmap pins into the host app's `config/importmap.rb` during installation.
|
|
23
|
+
- Both asset and importmap initializers gracefully skip when the host app doesn't use the relevant gems.
|
|
24
|
+
|
|
8
25
|
## [0.2.0] - 2026-02-21
|
|
9
26
|
|
|
10
27
|
### Added
|
|
@@ -67,6 +84,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
67
84
|
- i18n support for all UI strings
|
|
68
85
|
- Install generator (`rails generate markdowndocs:install`)
|
|
69
86
|
|
|
87
|
+
[0.2.2]: https://github.com/dschmura/markdowndocs/releases/tag/v0.2.2
|
|
88
|
+
[0.2.1]: https://github.com/dschmura/markdowndocs/releases/tag/v0.2.1
|
|
70
89
|
[0.2.0]: https://github.com/dschmura/markdowndocs/releases/tag/v0.2.0
|
|
71
90
|
[0.1.5]: https://github.com/dschmura/markdowndocs/releases/tag/v0.1.5
|
|
72
91
|
[0.1.4]: https://github.com/dschmura/markdowndocs/releases/tag/v0.1.4
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import DocsSearchController from "markdowndocs/controllers/docs_search_controller"
|
|
2
|
+
import DocsModeController from "markdowndocs/controllers/docs_mode_controller"
|
|
3
|
+
|
|
4
|
+
// Auto-register if Stimulus application exists on window, otherwise
|
|
5
|
+
// the host app can import and register these controllers manually.
|
|
6
|
+
if (window.Stimulus) {
|
|
7
|
+
window.Stimulus.register("docs-search", DocsSearchController)
|
|
8
|
+
window.Stimulus.register("docs-mode", DocsModeController)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { DocsSearchController, DocsModeController }
|
data/config/importmap.rb
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Importmap pins for Markdowndocs engine.
|
|
4
|
+
# These are automatically registered with the host app when importmap-rails is present.
|
|
5
|
+
|
|
6
|
+
pin "markdowndocs", to: "markdowndocs/application.js"
|
|
7
|
+
pin "markdowndocs/controllers/docs_search_controller", to: "markdowndocs/controllers/docs_search_controller.js"
|
|
8
|
+
pin "markdowndocs/controllers/docs_mode_controller", to: "markdowndocs/controllers/docs_mode_controller.js"
|
|
9
|
+
pin "minisearch", to: "markdowndocs/vendor/minisearch.min.js"
|
|
@@ -20,6 +20,21 @@ module Markdowndocs
|
|
|
20
20
|
route 'mount Markdowndocs::Engine, at: "/docs"'
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
+
def add_markdowndocs_import
|
|
24
|
+
js_file = Rails.root.join("app/javascript/application.js").to_s
|
|
25
|
+
return unless File.exist?(js_file)
|
|
26
|
+
|
|
27
|
+
js_content = File.read(js_file)
|
|
28
|
+
import_line = 'import "markdowndocs"'
|
|
29
|
+
|
|
30
|
+
if js_content.include?(import_line)
|
|
31
|
+
say_status :skip, "markdowndocs import already present in application.js", :yellow
|
|
32
|
+
else
|
|
33
|
+
append_to_file js_file, "\n#{import_line}\n"
|
|
34
|
+
say_status :import, "markdowndocs in application.js", :green
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
23
38
|
def inject_tailwind_source
|
|
24
39
|
css_file = find_tailwind_css_file
|
|
25
40
|
return unless css_file
|
|
@@ -54,6 +69,9 @@ module Markdowndocs
|
|
|
54
69
|
say " @source \"#{Markdowndocs::Engine.root.join("app", "views")}/**/*.erb\";"
|
|
55
70
|
say ""
|
|
56
71
|
end
|
|
72
|
+
say " Stimulus controllers are auto-registered via: import \"markdowndocs\"", :green
|
|
73
|
+
say " If this was not added automatically, add it to app/javascript/application.js"
|
|
74
|
+
say ""
|
|
57
75
|
end
|
|
58
76
|
|
|
59
77
|
private
|
data/lib/markdowndocs/engine.rb
CHANGED
|
@@ -7,5 +7,26 @@ module Markdowndocs
|
|
|
7
7
|
initializer "markdowndocs.i18n" do
|
|
8
8
|
config.i18n.load_path += Dir[root.join("config/locales/**/*.yml")]
|
|
9
9
|
end
|
|
10
|
+
|
|
11
|
+
initializer "markdowndocs.assets" do |app|
|
|
12
|
+
if app.config.respond_to?(:assets)
|
|
13
|
+
app.config.assets.paths << root.join("app/assets/javascripts")
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
initializer "markdowndocs.importmap", before: "importmap" do |app|
|
|
18
|
+
if app.config.respond_to?(:importmap)
|
|
19
|
+
app.config.importmap.paths << root.join("config/importmap.rb")
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
initializer "markdowndocs.stimulus" do
|
|
24
|
+
Rails.application.config.after_initialize do
|
|
25
|
+
if defined?(Importmap)
|
|
26
|
+
# The pin is already added via importmap.rb
|
|
27
|
+
# Host app just needs: import "markdowndocs" in their application.js
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
10
31
|
end
|
|
11
32
|
end
|
data/lib/markdowndocs/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: markdowndocs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dave Chmura
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-03-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -78,6 +78,7 @@ files:
|
|
|
78
78
|
- CHANGELOG.md
|
|
79
79
|
- README.md
|
|
80
80
|
- Rakefile
|
|
81
|
+
- app/assets/javascripts/markdowndocs/application.js
|
|
81
82
|
- app/assets/javascripts/markdowndocs/controllers/docs_mode_controller.js
|
|
82
83
|
- app/assets/javascripts/markdowndocs/controllers/docs_search_controller.js
|
|
83
84
|
- app/assets/javascripts/markdowndocs/vendor/minisearch.min.js
|
|
@@ -93,6 +94,7 @@ files:
|
|
|
93
94
|
- app/views/markdowndocs/docs/_navigation.html.erb
|
|
94
95
|
- app/views/markdowndocs/docs/index.html.erb
|
|
95
96
|
- app/views/markdowndocs/docs/show.html.erb
|
|
97
|
+
- config/importmap.rb
|
|
96
98
|
- config/locales/en.yml
|
|
97
99
|
- config/routes.rb
|
|
98
100
|
- lib/generators/markdowndocs/install/install_generator.rb
|