mkdocs_rails 1.0.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 +7 -0
- data/CHANGELOG.md +20 -0
- data/LICENSE.txt +21 -0
- data/README.md +92 -0
- data/Rakefile +12 -0
- data/lib/generators/mkdocs_rails/install/install_generator.rb +57 -0
- data/lib/generators/mkdocs_rails/install/templates/bin/docs.tt +178 -0
- data/lib/generators/mkdocs_rails/install/templates/docs/index_material.md.tt +48 -0
- data/lib/generators/mkdocs_rails/install/templates/docs/index_vanilla.md.tt +30 -0
- data/lib/generators/mkdocs_rails/install/templates/mkdocs-packages.tt +18 -0
- data/lib/generators/mkdocs_rails/install/templates/mkdocs_material.yml.tt +58 -0
- data/lib/generators/mkdocs_rails/install/templates/mkdocs_vanilla.yml.tt +28 -0
- data/lib/mkdocs_rails/version.rb +5 -0
- data/lib/mkdocs_rails.rb +7 -0
- data/sig/mkdocs_rails.rbs +4 -0
- metadata +73 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e5928dee130cd403c098bba987855573ac63d4e421eddaf21d8d1a1273124982
|
|
4
|
+
data.tar.gz: f437f4508e82f2e69ba322e9136b605d82c78fd0547faa6ad4ef005332011490
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 27c4feb927d580d8017b10cc25c32718d2da3de32bfee404219bfdde25b53b8035496619ed581528a1c132d9aee5253556ede15cd0bb9f6985d41414fab58d7e
|
|
7
|
+
data.tar.gz: 7576bf72d80deae358a0c5d3a8fd3b12512d2af99760c42fff9493a3a79982cb17e6aeb2af9af1c3e090f046aae0312b8139929347351a9493610647d155c201
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.0.0] - 2025-11-03
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Initial stable release
|
|
9
|
+
- Rails generator for creating a full MkDocs documentation structure
|
|
10
|
+
- Support for both **Material for MkDocs** and vanilla MkDocs themes
|
|
11
|
+
- Automatic creation and management of a local Python virtual environment
|
|
12
|
+
- Plugin auto-detection and installation from `docs/mkdocs.yml`
|
|
13
|
+
- Custom plugin mappings via `docs/.mkdocs-packages`
|
|
14
|
+
- `bin/docs` helper script with the following commands:
|
|
15
|
+
- `setup` – sets up the Python environment and installs dependencies
|
|
16
|
+
- `serve` – starts the MkDocs development server
|
|
17
|
+
- `publish` – builds and outputs static docs to `public/docs` for Rails serving
|
|
18
|
+
- `clean` – removes the published documentation files from `public/docs`
|
|
19
|
+
|
|
20
|
+
[1.0.0]: https://github.com/yarbro/mkdocs_rails/releases/tag/v1.0.0
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 David Yarbro
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# MkDocs Rails
|
|
2
|
+
|
|
3
|
+
Easy MkDocs setup for Rails development.
|
|
4
|
+
|
|
5
|
+
## What It Does
|
|
6
|
+
|
|
7
|
+
Adds [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) (or vanilla MkDocs) to your Rails app with one command. Perfect for internal documentation, API docs, and developer guides.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
Add to your Gemfile:
|
|
12
|
+
```ruby
|
|
13
|
+
gem "mkdocs_rails", group: :development
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Then run:
|
|
17
|
+
```bash
|
|
18
|
+
bundle install
|
|
19
|
+
rails generate mkdocs_rails:install
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# First-time setup (creates a local Python venv and installs packages)
|
|
26
|
+
bin/docs setup
|
|
27
|
+
|
|
28
|
+
# Start the MkDocs development server
|
|
29
|
+
bin/docs serve
|
|
30
|
+
# Visit http://localhost:8000
|
|
31
|
+
|
|
32
|
+
# Build static docs directly into Rails public/docs
|
|
33
|
+
bin/docs publish
|
|
34
|
+
|
|
35
|
+
# Clean the public/docs directory
|
|
36
|
+
bin/docs clean
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The publish command outputs a production-ready static site to `public/docs`, automatically served by Rails at:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
http://localhost:3000/docs/
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The trailing slash (/) is required for the static docs to display correctly.
|
|
46
|
+
|
|
47
|
+
## Features
|
|
48
|
+
|
|
49
|
+
- Generator creates complete MkDocs project structure
|
|
50
|
+
- Material for MkDocs theme by default (or use `--vanilla` for plain MkDocs)
|
|
51
|
+
- Automatic Python virtual environment management
|
|
52
|
+
- Auto-detects and installs plugins from `mkdocs.yml`
|
|
53
|
+
- Simple `bin/docs` script for common tasks
|
|
54
|
+
|
|
55
|
+
## Customization
|
|
56
|
+
|
|
57
|
+
### Using Vanilla MkDocs
|
|
58
|
+
```bash
|
|
59
|
+
rails generate mkdocs_rails:install --vanilla
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Adding Plugins
|
|
63
|
+
|
|
64
|
+
Edit `docs/mkdocs.yml`:
|
|
65
|
+
```yaml
|
|
66
|
+
plugins:
|
|
67
|
+
- search
|
|
68
|
+
- awesome-pages
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Most plugins follow the convention `mkdocs-{name}-plugin`. For custom package names, create `docs/.mkdocs-packages`:
|
|
72
|
+
```yaml
|
|
73
|
+
plugins:
|
|
74
|
+
awesome-pages: mkdocs-awesome-pages-plugin
|
|
75
|
+
glightbox: mkdocs-glightbox
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Then run `bin/docs setup` to install.
|
|
79
|
+
|
|
80
|
+
## Contributing
|
|
81
|
+
|
|
82
|
+
Bug reports and pull requests are welcome.
|
|
83
|
+
|
|
84
|
+
1. Fork it
|
|
85
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
86
|
+
3. Commit your changes (`git commit -am "Added some new feature"`)
|
|
87
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
88
|
+
5. Create a new Pull Request
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module MkdocsRails
|
|
4
|
+
class InstallGenerator < Rails::Generators::Base
|
|
5
|
+
source_root File.expand_path("templates", __dir__)
|
|
6
|
+
|
|
7
|
+
class_option :vanilla,
|
|
8
|
+
type: :boolean,
|
|
9
|
+
default: false,
|
|
10
|
+
desc: "Use vanilla MkDocs instead of Material for MkDocs"
|
|
11
|
+
|
|
12
|
+
# TODO: Make this configurable
|
|
13
|
+
def create_docs_structure
|
|
14
|
+
empty_directory "docs"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def copy_mkdocs_config
|
|
18
|
+
if options[:vanilla]
|
|
19
|
+
template "mkdocs_vanilla.yml.tt", "mkdocs.yml"
|
|
20
|
+
template "docs/index_vanilla.md.tt", "docs/index.md"
|
|
21
|
+
else
|
|
22
|
+
template "mkdocs_material.yml.tt", "mkdocs.yml"
|
|
23
|
+
template "docs/index_material.md.tt", "docs/index.md"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def copy_package_mapping_template
|
|
28
|
+
template "mkdocs-packages.tt", "docs/.mkdocs-packages"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def copy_bin_script
|
|
32
|
+
template "bin/docs.tt", "bin/docs"
|
|
33
|
+
chmod "bin/docs", 0o755
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def show_instructions
|
|
37
|
+
say "\n"
|
|
38
|
+
say "MkDocs Rails installed with #{theme_name}!", :green
|
|
39
|
+
say "\n"
|
|
40
|
+
say "Next steps:", :yellow
|
|
41
|
+
say " 1. Run setup: bin/docs setup"
|
|
42
|
+
say " 2. Start docs: bin/docs serve"
|
|
43
|
+
say " 3. Visit: http://localhost:8000"
|
|
44
|
+
say "\n"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def theme_name
|
|
50
|
+
options[:vanilla] ? "MkDocs" : "Material for MkDocs"
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def app_name
|
|
54
|
+
Rails.application.class.module_parent_name
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "fileutils"
|
|
5
|
+
require "yaml"
|
|
6
|
+
|
|
7
|
+
DOCS_DIR = File.expand_path("../docs", __dir__)
|
|
8
|
+
PROJECT_ROOT = File.expand_path("..", __dir__)
|
|
9
|
+
PUBLIC_DOCS_DIR = File.join(PROJECT_ROOT, "public", "docs")
|
|
10
|
+
VENV_DIR = File.join(PROJECT_ROOT, ".python-venv")
|
|
11
|
+
MKDOCS_CONFIG = File.join(PROJECT_ROOT, "mkdocs.yml")
|
|
12
|
+
GITIGNORE_PATH = File.join(PROJECT_ROOT, ".gitignore")
|
|
13
|
+
PACKAGES_FILE = File.join(DOCS_DIR, ".mkdocs-packages")
|
|
14
|
+
|
|
15
|
+
def mkdocs_command
|
|
16
|
+
venv_mkdocs = File.join(VENV_DIR, "bin", "mkdocs")
|
|
17
|
+
File.exist?(venv_mkdocs) ? venv_mkdocs : "mkdocs"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def pip_command
|
|
21
|
+
venv_pip = File.join(VENV_DIR, "bin", "pip")
|
|
22
|
+
File.exist?(venv_pip) ? venv_pip : "pip3"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def venv_exists?
|
|
26
|
+
Dir.exist?(VENV_DIR) && File.exist?(File.join(VENV_DIR, "bin", "python"))
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def update_gitignore
|
|
30
|
+
return unless File.exist?(GITIGNORE_PATH)
|
|
31
|
+
return if File.read(GITIGNORE_PATH).include?(".python-venv")
|
|
32
|
+
|
|
33
|
+
File.open(GITIGNORE_PATH, "a") do |f|
|
|
34
|
+
f.puts "\n# MkDocs Python virtual environment"
|
|
35
|
+
f.puts ".python-venv/"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
puts "Added .python-venv/ to .gitignore"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def load_custom_mappings
|
|
42
|
+
return {} unless File.exist?(PACKAGES_FILE)
|
|
43
|
+
|
|
44
|
+
config = YAML.load_file(PACKAGES_FILE)
|
|
45
|
+
config["plugins"] || {}
|
|
46
|
+
rescue StandardError => e
|
|
47
|
+
puts "Warning: Could not parse .mkdocs-packages: #{e.message}"
|
|
48
|
+
{}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def load_mkdocs_config
|
|
52
|
+
return {} unless File.exist?(MKDOCS_CONFIG)
|
|
53
|
+
|
|
54
|
+
YAML.load_file(MKDOCS_CONFIG)
|
|
55
|
+
rescue StandardError => e
|
|
56
|
+
puts "Warning: Could not parse mkdocs.yml: #{e.message}"
|
|
57
|
+
{}
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def detect_theme_package(config)
|
|
61
|
+
theme_field = config["theme"]
|
|
62
|
+
theme_name =
|
|
63
|
+
if theme_field.is_a?(Hash)
|
|
64
|
+
theme_field["name"]
|
|
65
|
+
else
|
|
66
|
+
theme_field
|
|
67
|
+
end
|
|
68
|
+
theme_name == "material" ? "mkdocs-material" : "mkdocs"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def detect_plugin_packages(config, custom_mappings)
|
|
72
|
+
plugins = config["plugins"] || []
|
|
73
|
+
|
|
74
|
+
plugins.map do |plugin|
|
|
75
|
+
plugin_name = plugin.is_a?(Hash) ? plugin.keys.first : plugin
|
|
76
|
+
next if plugin_name == "search" # Built-in
|
|
77
|
+
|
|
78
|
+
custom_mappings[plugin_name] || "mkdocs-#{plugin_name}-plugin"
|
|
79
|
+
end.compact
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def detect_required_packages
|
|
83
|
+
config = load_mkdocs_config
|
|
84
|
+
return ["mkdocs-material"] if config.empty?
|
|
85
|
+
|
|
86
|
+
theme_package = detect_theme_package(config)
|
|
87
|
+
custom_mappings = load_custom_mappings
|
|
88
|
+
plugin_packages = detect_plugin_packages(config, custom_mappings)
|
|
89
|
+
|
|
90
|
+
[theme_package] + plugin_packages
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def package_installed?(package)
|
|
94
|
+
base_package = package.split("[").first
|
|
95
|
+
system("#{pip_command} show #{base_package} > /dev/null 2>&1")
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def install_packages(packages)
|
|
99
|
+
return if packages.empty?
|
|
100
|
+
|
|
101
|
+
puts "Installing: #{packages.join(", ")}"
|
|
102
|
+
system("#{pip_command} install #{packages.join(" ")}") || exit(1)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def create_venv_if_missing
|
|
106
|
+
return if venv_exists?
|
|
107
|
+
|
|
108
|
+
puts "Creating Python virtual environment..."
|
|
109
|
+
system("python3 -m venv #{VENV_DIR}") || exit(1)
|
|
110
|
+
update_gitignore
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def install_missing_packages
|
|
114
|
+
required = detect_required_packages
|
|
115
|
+
missing = required.reject { |pkg| package_installed?(pkg) }
|
|
116
|
+
|
|
117
|
+
if missing.empty?
|
|
118
|
+
puts "✓ All packages already installed!"
|
|
119
|
+
else
|
|
120
|
+
install_packages(missing)
|
|
121
|
+
end
|
|
122
|
+
required
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def setup_mkdocs
|
|
126
|
+
puts "Setting up MkDocs..."
|
|
127
|
+
|
|
128
|
+
create_venv_if_missing
|
|
129
|
+
installed_packages = install_missing_packages
|
|
130
|
+
|
|
131
|
+
puts "\n✓ MkDocs setup complete!"
|
|
132
|
+
puts "\nInstalled packages:"
|
|
133
|
+
installed_packages.each { |pkg| puts " - #{pkg}" }
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def run_mkdocs(command)
|
|
137
|
+
Dir.chdir(PROJECT_ROOT) do
|
|
138
|
+
system("#{mkdocs_command} #{command}") || exit(1)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
case ARGV[0]
|
|
143
|
+
when "setup"
|
|
144
|
+
setup_mkdocs
|
|
145
|
+
|
|
146
|
+
when "serve", "s"
|
|
147
|
+
# Auto-install any new plugins before serving
|
|
148
|
+
missing = detect_required_packages.reject { |pkg| package_installed?(pkg) }
|
|
149
|
+
install_packages(missing) unless missing.empty?
|
|
150
|
+
|
|
151
|
+
puts "Starting MkDocs server..."
|
|
152
|
+
run_mkdocs("serve")
|
|
153
|
+
|
|
154
|
+
when "publish", "p"
|
|
155
|
+
FileUtils.mkdir_p(PUBLIC_DOCS_DIR)
|
|
156
|
+
puts "Publishing documentation to #{PUBLIC_DOCS_DIR}..."
|
|
157
|
+
run_mkdocs("build -d #{PUBLIC_DOCS_DIR}")
|
|
158
|
+
|
|
159
|
+
when "clean"
|
|
160
|
+
puts "Cleaning build directory..."
|
|
161
|
+
FileUtils.rm_rf(File.join(PUBLIC_DOCS_DIR))
|
|
162
|
+
puts "Done!"
|
|
163
|
+
|
|
164
|
+
else
|
|
165
|
+
puts <<~HELP
|
|
166
|
+
MkDocs Rails Helper
|
|
167
|
+
|
|
168
|
+
Usage:
|
|
169
|
+
bin/docs setup Install MkDocs and plugins
|
|
170
|
+
bin/docs serve Start the development server
|
|
171
|
+
bin/docs publish Publish documentation to public directory
|
|
172
|
+
bin/docs clean Remove public docs directory
|
|
173
|
+
|
|
174
|
+
Plugin Detection:
|
|
175
|
+
Plugins are auto-detected from mkdocs.yml and auto-installed.
|
|
176
|
+
Custom package mappings can be added to docs/.mkdocs-packages
|
|
177
|
+
HELP
|
|
178
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Welcome to <%= app_name %> Documentation
|
|
2
|
+
|
|
3
|
+
Welcome! This is your documentation powered by Material for MkDocs.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
Edit this file at `docs/docs/index.md` to customize your documentation.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- 🎨 Beautiful Material Design theme
|
|
12
|
+
- 🌓 Dark/light mode toggle
|
|
13
|
+
- 🔍 Instant search
|
|
14
|
+
- 📱 Mobile responsive
|
|
15
|
+
- 💻 Syntax highlighting
|
|
16
|
+
|
|
17
|
+
## Quick Links
|
|
18
|
+
|
|
19
|
+
- [MkDocs Documentation](https://www.mkdocs.org/)
|
|
20
|
+
- [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/)
|
|
21
|
+
|
|
22
|
+
## Adding More Pages
|
|
23
|
+
|
|
24
|
+
Create new markdown files in `docs/docs/` and add them to the navigation in `docs/mkdocs.yml`.
|
|
25
|
+
```yaml
|
|
26
|
+
nav:
|
|
27
|
+
- Home: index.md
|
|
28
|
+
- Getting Started: getting-started.md
|
|
29
|
+
- API Reference: api.md
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Code Examples
|
|
33
|
+
```ruby
|
|
34
|
+
# Example Ruby code
|
|
35
|
+
class User < ApplicationRecord
|
|
36
|
+
has_many :posts
|
|
37
|
+
validates :email, presence: true
|
|
38
|
+
end
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
!!! tip "Pro Tip"
|
|
42
|
+
Use admonitions to highlight important information!
|
|
43
|
+
|
|
44
|
+
!!! warning "Warning"
|
|
45
|
+
This is a warning admonition.
|
|
46
|
+
|
|
47
|
+
!!! info "Information"
|
|
48
|
+
This is an info admonition.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Welcome to <%= app_name %> Documentation
|
|
2
|
+
|
|
3
|
+
Welcome! This is your documentation powered by MkDocs.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
Edit this file at `docs/docs/index.md` to customize your documentation.
|
|
8
|
+
|
|
9
|
+
## Adding More Pages
|
|
10
|
+
|
|
11
|
+
Create new markdown files in `docs/docs/` and add them to the navigation in `docs/mkdocs.yml`.
|
|
12
|
+
```yaml
|
|
13
|
+
nav:
|
|
14
|
+
- Home: index.md
|
|
15
|
+
- Getting Started: getting-started.md
|
|
16
|
+
- API Reference: api.md
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Code Examples
|
|
20
|
+
```ruby
|
|
21
|
+
# Example Ruby code
|
|
22
|
+
class User < ApplicationRecord
|
|
23
|
+
has_many :posts
|
|
24
|
+
validates :email, presence: true
|
|
25
|
+
end
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Resources
|
|
29
|
+
|
|
30
|
+
- [MkDocs Documentation](https://www.mkdocs.org/)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Custom package mappings for MkDocs plugins
|
|
2
|
+
# Only needed if a plugin doesn't follow the mkdocs-{name}-plugin convention
|
|
3
|
+
#
|
|
4
|
+
# Format:
|
|
5
|
+
# plugin-name: package-name
|
|
6
|
+
#
|
|
7
|
+
# Example:
|
|
8
|
+
# If your mkdocs.yml has:
|
|
9
|
+
# plugins:
|
|
10
|
+
# - awesome-pages
|
|
11
|
+
#
|
|
12
|
+
# And the package name is mkdocs-awesome-pages-plugin, add:
|
|
13
|
+
# plugins:
|
|
14
|
+
# awesome-pages: mkdocs-awesome-pages-plugin
|
|
15
|
+
#
|
|
16
|
+
# After adding mappings here, run: bin/docs setup
|
|
17
|
+
|
|
18
|
+
plugins: {}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
site_name: <%= app_name %> Documentation
|
|
2
|
+
site_description: Documentation for <%= app_name %>
|
|
3
|
+
|
|
4
|
+
# Uncomment to link to your repository
|
|
5
|
+
# repo_name: username/repo
|
|
6
|
+
# repo_url: https://github.com/username/repo
|
|
7
|
+
# edit_uri: edit/main/docs/
|
|
8
|
+
|
|
9
|
+
theme:
|
|
10
|
+
name: material
|
|
11
|
+
# Uncomment to customize branding
|
|
12
|
+
# logo: assets/logo.png
|
|
13
|
+
# favicon: assets/favicon.png
|
|
14
|
+
palette:
|
|
15
|
+
# Light mode
|
|
16
|
+
- scheme: default
|
|
17
|
+
primary: indigo
|
|
18
|
+
accent: indigo
|
|
19
|
+
toggle:
|
|
20
|
+
icon: material/brightness-7
|
|
21
|
+
name: Switch to dark mode
|
|
22
|
+
# Dark mode
|
|
23
|
+
- scheme: slate
|
|
24
|
+
primary: indigo
|
|
25
|
+
accent: indigo
|
|
26
|
+
toggle:
|
|
27
|
+
icon: material/brightness-4
|
|
28
|
+
name: Switch to light mode
|
|
29
|
+
features:
|
|
30
|
+
- navigation.instant
|
|
31
|
+
- navigation.tracking
|
|
32
|
+
- navigation.tabs
|
|
33
|
+
- navigation.sections
|
|
34
|
+
- navigation.expand
|
|
35
|
+
- navigation.top
|
|
36
|
+
- search.suggest
|
|
37
|
+
- search.highlight
|
|
38
|
+
- content.code.copy
|
|
39
|
+
|
|
40
|
+
markdown_extensions:
|
|
41
|
+
- pymdownx.highlight:
|
|
42
|
+
anchor_linenums: true
|
|
43
|
+
- pymdownx.superfences
|
|
44
|
+
- pymdownx.tabbed:
|
|
45
|
+
alternate_style: true
|
|
46
|
+
- admonition
|
|
47
|
+
- pymdownx.details
|
|
48
|
+
- attr_list
|
|
49
|
+
- md_in_html
|
|
50
|
+
|
|
51
|
+
# Plugins are auto-installed by bin/docs setup
|
|
52
|
+
# Most plugins follow the convention: mkdocs-{name}-plugin
|
|
53
|
+
# For custom mappings, create docs/.mkdocs-packages
|
|
54
|
+
plugins:
|
|
55
|
+
- search
|
|
56
|
+
|
|
57
|
+
nav:
|
|
58
|
+
- Home: index.md
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
site_name: <%= app_name %> Documentation
|
|
2
|
+
site_description: Documentation for <%= app_name %>
|
|
3
|
+
|
|
4
|
+
# Uncomment to link to your repository
|
|
5
|
+
# repo_name: username/repo
|
|
6
|
+
# repo_url: https://github.com/username/repo
|
|
7
|
+
# edit_uri: edit/main/docs/
|
|
8
|
+
|
|
9
|
+
theme:
|
|
10
|
+
name: mkdocs
|
|
11
|
+
|
|
12
|
+
markdown_extensions:
|
|
13
|
+
- admonition
|
|
14
|
+
- codehilite:
|
|
15
|
+
guess_lang: false
|
|
16
|
+
- toc:
|
|
17
|
+
permalink: true
|
|
18
|
+
- tables
|
|
19
|
+
- fenced_code
|
|
20
|
+
|
|
21
|
+
# Plugins are auto-installed by bin/docs setup
|
|
22
|
+
# Most plugins follow the convention: mkdocs-{name}-plugin
|
|
23
|
+
# For custom mappings, create docs/.mkdocs-packages
|
|
24
|
+
plugins:
|
|
25
|
+
- search
|
|
26
|
+
|
|
27
|
+
nav:
|
|
28
|
+
- Home: index.md
|
data/lib/mkdocs_rails.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: mkdocs_rails
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- David Yarbro
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: rails
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '6.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '6.0'
|
|
26
|
+
description: Add Material for MkDocs documentation to your Rails app with generators
|
|
27
|
+
and helpful scripts
|
|
28
|
+
email:
|
|
29
|
+
- david@yarb.ro
|
|
30
|
+
executables: []
|
|
31
|
+
extensions: []
|
|
32
|
+
extra_rdoc_files: []
|
|
33
|
+
files:
|
|
34
|
+
- CHANGELOG.md
|
|
35
|
+
- LICENSE.txt
|
|
36
|
+
- README.md
|
|
37
|
+
- Rakefile
|
|
38
|
+
- lib/generators/mkdocs_rails/install/install_generator.rb
|
|
39
|
+
- lib/generators/mkdocs_rails/install/templates/bin/docs.tt
|
|
40
|
+
- lib/generators/mkdocs_rails/install/templates/docs/index_material.md.tt
|
|
41
|
+
- lib/generators/mkdocs_rails/install/templates/docs/index_vanilla.md.tt
|
|
42
|
+
- lib/generators/mkdocs_rails/install/templates/mkdocs-packages.tt
|
|
43
|
+
- lib/generators/mkdocs_rails/install/templates/mkdocs_material.yml.tt
|
|
44
|
+
- lib/generators/mkdocs_rails/install/templates/mkdocs_vanilla.yml.tt
|
|
45
|
+
- lib/mkdocs_rails.rb
|
|
46
|
+
- lib/mkdocs_rails/version.rb
|
|
47
|
+
- sig/mkdocs_rails.rbs
|
|
48
|
+
homepage: https://github.com/yarbro/mkdocs_rails
|
|
49
|
+
licenses:
|
|
50
|
+
- MIT
|
|
51
|
+
metadata:
|
|
52
|
+
homepage_uri: https://github.com/yarbro/mkdocs_rails
|
|
53
|
+
source_code_uri: https://github.com/yarbro/mkdocs_rails
|
|
54
|
+
changelog_uri: https://github.com/yarbro/mkdocs_rails/releases
|
|
55
|
+
rubygems_mfa_required: 'true'
|
|
56
|
+
rdoc_options: []
|
|
57
|
+
require_paths:
|
|
58
|
+
- lib
|
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
60
|
+
requirements:
|
|
61
|
+
- - ">="
|
|
62
|
+
- !ruby/object:Gem::Version
|
|
63
|
+
version: 2.7.0
|
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
requirements: []
|
|
70
|
+
rubygems_version: 3.6.9
|
|
71
|
+
specification_version: 4
|
|
72
|
+
summary: Easy MkDocs setup for Rails development
|
|
73
|
+
test_files: []
|