mint 0.8.1 → 0.10.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.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -26
  3. data/README.md +117 -37
  4. data/bin/mint +2 -81
  5. data/config/templates/base/navigation.css +136 -0
  6. data/config/templates/base/print.css +152 -0
  7. data/config/templates/{reset.css → base/reset.css} +1 -1
  8. data/config/templates/base/style.css +117 -137
  9. data/config/templates/base/utilities.css +136 -0
  10. data/config/templates/base/variables.css +124 -0
  11. data/config/templates/basic/style.css +151 -0
  12. data/config/templates/default/layout.erb +33 -3
  13. data/config/templates/default/style.css +95 -164
  14. data/config/templates/magazine/style.css +383 -0
  15. data/config/templates/nord/style.css +105 -220
  16. data/config/templates/nord-dark/style.css +82 -263
  17. data/lib/mint/commandline/parse.rb +144 -0
  18. data/lib/mint/commandline/publish.rb +46 -0
  19. data/lib/mint/commandline/run.rb +30 -0
  20. data/lib/mint/config.rb +162 -0
  21. data/lib/mint/{css.rb → css_dsl.rb} +9 -9
  22. data/lib/mint/css_parser.rb +45 -25
  23. data/lib/mint/document.rb +250 -365
  24. data/lib/mint/document_tree.rb +163 -0
  25. data/lib/mint/exceptions.rb +2 -3
  26. data/lib/mint/helpers.rb +23 -180
  27. data/lib/mint/layout.rb +26 -9
  28. data/lib/mint/renderers/css_renderer.rb +32 -0
  29. data/lib/mint/renderers/erb_renderer.rb +11 -0
  30. data/lib/mint/renderers/markdown_renderer.rb +45 -0
  31. data/lib/mint/style.rb +21 -31
  32. data/lib/mint/template.rb +30 -0
  33. data/lib/mint/version.rb +1 -1
  34. data/lib/mint/workspace.rb +171 -0
  35. data/lib/mint.rb +44 -12
  36. data/man/mint.1 +85 -44
  37. data/spec/cli/README.md +2 -2
  38. data/spec/cli/argument_parsing_spec.rb +89 -147
  39. data/spec/cli/bin_integration_spec.rb +23 -243
  40. data/spec/cli/full_workflow_integration_spec.rb +99 -442
  41. data/spec/cli/original_style_integration_spec.rb +58 -0
  42. data/spec/cli/publish_workflow_spec.rb +72 -70
  43. data/spec/commandline_path_integration_spec.rb +230 -0
  44. data/spec/config_file_integration_spec.rb +362 -0
  45. data/spec/{css_spec.rb → css_dsl_spec.rb} +7 -3
  46. data/spec/css_parser_spec.rb +59 -1
  47. data/spec/document_spec.rb +37 -242
  48. data/spec/flattened_path_spec.rb +150 -0
  49. data/spec/layout_spec.rb +42 -3
  50. data/spec/mint_spec.rb +22 -217
  51. data/spec/path_handling_spec.rb +237 -0
  52. data/spec/run_cli_tests.rb +1 -1
  53. data/spec/spec_helper.rb +3 -10
  54. data/spec/style_spec.rb +31 -56
  55. data/spec/support/cli_helpers.rb +7 -10
  56. data/spec/support/matchers.rb +1 -1
  57. data/spec/template_spec.rb +31 -0
  58. data/spec/workspace_spec.rb +177 -0
  59. metadata +75 -89
  60. data/bin/mint-epub +0 -20
  61. data/config/templates/garden/layout.erb +0 -38
  62. data/config/templates/garden/style.css +0 -303
  63. data/config/templates/nord/layout.erb +0 -11
  64. data/config/templates/nord-dark/layout.erb +0 -11
  65. data/config/templates/zen/layout.erb +0 -11
  66. data/config/templates/zen/style.css +0 -114
  67. data/lib/mint/command_line.rb +0 -360
  68. data/lib/mint/css_template.rb +0 -37
  69. data/lib/mint/markdown_template.rb +0 -47
  70. data/lib/mint/mint.rb +0 -313
  71. data/lib/mint/plugin.rb +0 -136
  72. data/lib/mint/plugins/epub.rb +0 -293
  73. data/lib/mint/resource.rb +0 -101
  74. data/plugins/templates/epub/layouts/container.haml +0 -5
  75. data/plugins/templates/epub/layouts/content.haml +0 -35
  76. data/plugins/templates/epub/layouts/layout.haml +0 -6
  77. data/plugins/templates/epub/layouts/title.haml +0 -11
  78. data/plugins/templates/epub/layouts/toc.haml +0 -26
  79. data/spec/cli/configuration_management_spec.rb +0 -363
  80. data/spec/cli/template_management_spec.rb +0 -300
  81. data/spec/helpers_spec.rb +0 -249
  82. data/spec/plugin_spec.rb +0 -449
  83. data/spec/resource_spec.rb +0 -135
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49d66d53b189d1897ab9938358279f7dc0c4ede1d44926eba5f1b9b6f7d8344b
4
- data.tar.gz: '08b1882ec1972dbedd02c87e0e6a4cf1f61ca0a631c7f56bca20b4dfeb1ea36b'
3
+ metadata.gz: 49ea6b9145cae1e2d818755c3e58b4e4188bfc67a64f4a21920618a49dff5ff8
4
+ data.tar.gz: f87f2f93b543033c511616c846bf7a29162adced84bca4442702f0e7f1f903ff
5
5
  SHA512:
6
- metadata.gz: 3acb8ce3fc1856014e0efe3aa94d3720faeb8f677e2f9e3a46c541ecc8bd62f65a187558421ac10acc0599f813a8d161bed142bf44c75b51e6bc8f140351cc7f
7
- data.tar.gz: 3851e818c5bad026bfde0302c8fe3184dfe4d79e93ca87479e85590015bb3fd082926fe88f7397144b8fbbb4163ae9e602bbb510bf23da009d20943b334896c2
6
+ metadata.gz: 4388535cb5372e7ef4448ed7ce10e1cd82a807803656772005e8356fafe7015f9a504c1cd6580f8e701cc36714e9d06fc0e2e46310dddfdd0997714324c2611a
7
+ data.tar.gz: 02da67bfde18bf22c7639a5b653ebd5e4d4af3da208b54e0e0501c99572f786e537839012302c7c4c529c932f12ba9a84f26215ee9b30921df403b510b5fa47d
data/Gemfile CHANGED
@@ -1,27 +1,2 @@
1
1
  source "https://rubygems.org"
2
-
3
- # General
4
- gem "rubyzip", "~> 3.0", ">= 3.0.1"
5
- gem "hashie", "~> 5.0"
6
- gem "nokogiri", "1.15.5"
7
-
8
- # Templates
9
- gem "tilt", "~> 2.6", ">= 2.6.1"
10
- gem "redcarpet", "~> 3.6", ">= 3.6.1"
11
- gem "erubis", "~> 2.7"
12
- gem "haml", "~> 6.3"
13
- gem "sass-embedded", '~> 1.90'
14
-
15
- # Helpers
16
- gem "activesupport", "~> 8.0", ">= 8.0.2.1"
17
-
18
- group :development do
19
- gem "pry"
20
- end
21
-
22
- # Testing dependencies
23
- group :test do
24
- gem "rspec", "~> 3.13", ">= 3.13.1"
25
- gem "rspec-its", "~> 1.3"
26
- gem "colorize", "~> 1.1"
27
- end
2
+ gemspec
data/README.md CHANGED
@@ -2,13 +2,30 @@
2
2
 
3
3
  Transform your plain text documents into beautiful HTML documents with customizable styling and templates.
4
4
 
5
+ ![Status](https://github.com/davejacobs/mint/actions/workflows/build.yml/badge.svg)
6
+
7
+ ## Why Mint?
8
+
9
+ - **Focus on writing** – Keep documents as plain text
10
+ - **Beautiful output** – Professional-looking HTML ready for print or web
11
+ - **Digital gardens** – Easily publish linked sets of HTML documents from tools like Obsidian
12
+ - **Version control-friendly** – Text documents work great with Git
13
+ - **Scriptable** – Automate document processing and analysis
14
+ - **Highly customizable** – Create your own templates and styles
15
+
5
16
  ## Installation
6
17
 
7
18
  ```bash
8
19
  gem install mint
9
20
  ```
10
21
 
11
- ## Quick Start
22
+ ## Documentation
23
+
24
+ - **Complete usage guide:** [TUTORIAL.md](doc/TUTORIAL.md)
25
+ - **Man page:** `man mint`
26
+ - **API documentation:** [RubyDoc](http://www.rubydoc.info/github/davejacobs/mint)
27
+
28
+ ## Get started
12
29
 
13
30
  Transform a Markdown document into styled HTML:
14
31
 
@@ -16,17 +33,19 @@ Transform a Markdown document into styled HTML:
16
33
  mint publish Document.md
17
34
  ```
18
35
 
19
- This creates `Document.html` in your current directory with beautiful default styling.
36
+ This creates `Document.html` in your current directory with beautiful default styling. The styles
37
+ are inlined by default, so you can send your document to anyone you'd like, and they'll see the
38
+ same thing.
20
39
 
21
40
  ## Usage
22
41
 
23
- ### Basic Commands
42
+ ### Basic commands
24
43
 
25
44
  ```bash
26
- # Publish a single document
45
+ # Publish a single document with a default template
27
46
  mint publish Document.md
28
47
 
29
- # Publish with a template
48
+ # Publish with a non-default template
30
49
  mint publish Document.md --template nord
31
50
 
32
51
  # Publish to a specific directory
@@ -35,57 +54,118 @@ mint publish Document.md --destination public
35
54
  # Publish multiple files
36
55
  mint publish *.md --destination final-drafts
37
56
 
38
- # Publish a digital garden, with linked navigation
39
- mint publish content/**/*.md --template garden --destination public
57
+ # Read Markdown content piped from STDIN, limited to a single file; note the `-`
58
+ # as a special filename
59
+ echo "# Document" | mint publish - --output-file Document.html
60
+
61
+ # Publish multiple files and generate a left-hand navigation panel; use globs
62
+ # to recursively include nested files. By default, nested directories will
63
+ # be preserved, but any common directories for all files (in this case, `content`),
64
+ # will be automatically removed from the output ("autodropped").
65
+ mint publish content/**/*.md --destination public --navigation --navigation-title "Documentation"
66
+
67
+ # Guess document title (and h1 header) from filename
68
+ mint publish Document.md --file-title
40
69
  ```
41
70
 
42
- ### Common Options
71
+ ### Common options
43
72
 
44
73
  | Flag | Description |
45
74
  |------|-------------|
46
75
  | `-t, --template TEMPLATE` | Use a built-in template (combines layout + style) |
47
- | `-l, --layout LAYOUT` | Specify only the layout |
48
- | `-s, --style STYLE` | Specify only the style |
76
+ | `-l, --layout LAYOUT` | Specify only the template layout, by name |
77
+ | `-s, --style STYLE` | Specify only the template style, by name |
78
+ | `-m, --style-mode MODE` | How styles are included (inline, external, original) |
49
79
  | `-d, --destination DIR` | Output directory |
50
- | `-o, --output-file FORMAT` | Custom output filename format |
51
- | `--style-mode MODE` | How styles are included (inline, external, original) |
52
- | `--style-destination PATH` | Create external stylesheet and link it (sets mode to external) |
53
- | `-r, --recursive` | Find all Markdown files in any directories specified |
80
+ | `-o, --output-file FORMAT` | Custom output filename, with substitutions available |
81
+ | `--no-autodrop` | Do not automatically drop common parent directories from published files |
82
+ | `--no-preserve-structure` | Flatten all published files into one directory rather than preserving structure |
83
+ | `--file-title` | Extract title from filename and inject into template |
84
+ | `--navigation` | Enable navigation panel showing all files |
85
+ | `--navigation-title TITLE` | Set title for navigation panel |
86
+ | `--navigation-depth N` | Maximum depth to show in navigation after dropping levels (default: 3) |
87
+ | `-v, --verbose` | Show where documents were published |
54
88
 
55
- ### Style modes
89
+ ### Built-in templates
56
90
 
57
- Mint offers three ways to include styles in your HTML output:
91
+ - `default` Clean, centered, modern layout
92
+ - `basic` – Clean, minimal styling, focuses on text
93
+ - `nord` – Clean, uses Nord color scheme and sans text
94
+ - `nord-dark` – Dark version of Nord
95
+ - `magazine` – Refined & easy to adapt for publications
58
96
 
59
- - **`inline`** (default) – CSS is embedded directly in the HTML document as `<style>` tags
60
- - **`external`** – CSS is compiled and saved as separate files, linked with `<link>` tags
61
- - **`original`** – Links directly to original CSS template files without processing (for live editing)
97
+ ### Custom templates
62
98
 
63
- The `original` mode is particularly useful for template development, as it allows you to edit CSS files and see changes immediately without republishing. Only `.css` files are supported in this mode, and `@import` statements in CSS files will be included as additional `<link>` tags.
99
+ It's easy to write a custom template: simply create a directory in `~/.config/mint/templates` or `./mint/templates`
100
+ with the name of your new template. Create a `style.css` file and an optional `layout.html` file (which uses ERB
101
+ to include variables like the document title and body). If you opt not to create a new `layout.html`, the
102
+ layout from the default template will be used.
64
103
 
65
- ### Built-in templates
104
+ Mint layouts are written in ERB-flavored HTML, and stylesheets are written in CSS.
66
105
 
67
- - `default` – Clean, minimal styling
68
- - `nord` – Clean, uses Nord color scheme
69
- - `nord-dark` – Dark version of Nord
70
- - `garden` – For digital gardens; includes navigation
106
+ ## Configuration
71
107
 
72
- ## Documentation
108
+ Mint can be configured using TOML configuration files that specify defaults for commandline options.
109
+ Configuration options are loaded in the following order (later files override earlier ones):
73
110
 
74
- - **Complete usage guide:** [TUTORIAL.md](doc/TUTORIAL.md)
75
- - **Man page:** `man mint` (after installation)
76
- - **API documentation:** [RubyDoc](http://www.rubydoc.info/github/davejacobs/mint)
111
+ 1. **Global**: Built-in defaults
112
+ 2. **User**: `~/.config/mint/config.toml`
113
+ 3. **Local**: `.mint/config.toml`
114
+ 4. **Commandline**: Explicit flags override any other configuration
77
115
 
78
- ## Why Mint?
116
+ ### Example configuration file
79
117
 
80
- - **Focus on writing** Keep documents as plain text
81
- - **Version control friendly** – Text files work great with Git
82
- - **Scriptable** – Automate document processing
83
- - **Beautiful output** – Professional-looking HTML ready for print or web
84
- - **Highly customizable** – Create your own templates and styles
118
+ Create `.mint/config.toml` in your project directory:
119
+
120
+ ```toml
121
+ # Template and styling
122
+ template = "nord"
123
+
124
+ # File output handling
125
+ destination = "public"
126
+ preserve-structure = true
127
+ output-file = "%{basename}_processed.%{new_extension}"
128
+ style-mode = "external"
129
+
130
+ # Navigation
131
+ navigation = true
132
+ navigation-title = "My Docs"
133
+ navigation-autodrop = true # Automatically drop common directory levels (default: true)
134
+ navigation-depth = 3 # Maximum depth after dropping levels (default: 3)
135
+ navigation-drop = 1 # Alternative to autodrop - manually specify levels to drop
136
+
137
+ # Other options
138
+ file-title = true
139
+ working-dir = "/path/to/source"
140
+ ```
141
+
142
+ ### Overriding configuration file settings
85
143
 
86
- ## Templates and customization
144
+ For most flags, overriding your configuration file is simple: You can simply
145
+ specify a new value via commandline flags. Boolean flags require a slightly
146
+ different approach, the use of `--no-[option]` flags.
87
147
 
88
- Mint supports layouts written in HAML or ERB and stylesheets can be written in CSS, SCSS, or SASS.
148
+ If you've set `navigation = true` in `config.toml`, you can override that
149
+ at the commandline:
150
+
151
+ ```bash
152
+ mint publish docs.md --no-navigation
153
+ ```
154
+
155
+ Available `--no-` flags:
156
+ - `--no-preserve-structure` - Don't preserve directory structure
157
+ - `--no-navigation` - Disable navigation panel
158
+ - `--no-file-title` - Don't extract titles from filenames
159
+
160
+ ### Style modes
161
+
162
+ Mint offers three ways to include styles in your HTML output:
163
+
164
+ - `inline` (default) – CSS is embedded directly in the HTML document as `<style>` tags
165
+ - `external` – CSS is compiled and saved as separate files, linked with `<link>` tags
166
+ - `original` – Links directly to original CSS template files without processing (for live editing)
167
+
168
+ The `original` mode is particularly useful for template development, as it allows you to edit CSS files and see changes immediately without republishing. Only `.css` files are supported in this mode, and `@import` statements in CSS files will be included as additional `<link>` tags.
89
169
 
90
170
  ## Contributing
91
171
 
data/bin/mint CHANGED
@@ -1,87 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # Add /lib to path to override any local installations of Mint
3
+ # Override any local installations of Mint
4
4
  $LOAD_PATH.unshift File.expand_path('../lib', __dir__)
5
5
 
6
6
  require "mint"
7
- require "shellwords"
8
7
 
9
- argv, commandline_options, help =
10
- Mint::CommandLine.parse(ARGV).values_at(:argv, :options, :help)
11
-
12
- original_command = argv.first
13
- case (argv.shift || "help").downcase.to_sym
14
- when :publish
15
- # Aruba chokes here, so we use this hack to convince Mint we're
16
- # not in a pipeline
17
- files =
18
- if $stdin.tty? || ENV["MINT_NO_PIPE"]
19
- argv
20
- else
21
- $stdin.each_line.reduce [] do |list, line|
22
- list.concat(Shellwords.split(line))
23
- end
24
- end
25
- Mint::CommandLine.publish!(files, commandline_options)
26
- when :preview
27
- # Preview mode uses live CSS links instead of inline styles
28
- Mint.rendering_mode = :preview
29
- files =
30
- if $stdin.tty? || ENV["MINT_NO_PIPE"]
31
- argv
32
- else
33
- $stdin.each_line.reduce [] do |list, line|
34
- list.concat(Shellwords.split(line))
35
- end
36
- end
37
- Mint::CommandLine.publish!(files, commandline_options)
38
- when :help
39
- Mint::CommandLine.help(help)
40
- when :install
41
- file = argv.shift
42
- name = argv.shift
43
- scope = commandline_options[:scope] || :local
44
- Mint::CommandLine.install(file, name, scope)
45
- when :uninstall
46
- name = argv.shift
47
- scope = commandline_options[:scope] || :local
48
- Mint::CommandLine.uninstall(name, scope)
49
- when :templates
50
- filter = argv.shift
51
- scope = commandline_options[:scope] || :local
52
- Mint::CommandLine.templates(filter, scope)
53
- when :"edit-layout"
54
- name = argv.shift
55
- scope = commandline_options[:scope] || :local
56
- Mint::CommandLine.edit(name, :layout, scope)
57
- when :"edit-style"
58
- name = argv.shift
59
- scope = commandline_options[:scope] || :local
60
- Mint::CommandLine.edit(name, :style, scope)
61
- when :set
62
- key = argv.shift
63
- value = argv.shift
64
- scope = commandline_options[:scope] || :local
65
- Mint::CommandLine.set(key, value, scope)
66
- when :config
67
- Mint::CommandLine.config
68
- else
69
- # If no commands were found, search the PATH for commands prefixed
70
- # with mint-. If no matching executables are found, we know we've
71
- # been passed a set of documents, so parse the commandline options,
72
- # merge them with the config options, and start minting the
73
- # document list.
74
-
75
- begin
76
- if File.executable? "mint-#{original_command}"
77
- system "mint-#{original_command} #{argv[1..-1].join ' '}"
78
- else
79
- $stderr.puts "Error: Unknown command '#{original_command}'"
80
- Mint::CommandLine.help(help)
81
- exit 1
82
- end
83
- rescue
84
- Mint::CommandLine.help(help)
85
- exit 1
86
- end
87
- end
8
+ Mint::Commandline.run!(ARGV)
@@ -0,0 +1,136 @@
1
+ /* Base Navigation Layout - Structural styles only */
2
+ /* Colors, fonts, and borders should be overridden in individual templates */
3
+
4
+ /* Navigation container positioning and dimensions */
5
+ #navigation {
6
+ position: fixed;
7
+ left: 0;
8
+ top: 0;
9
+ width: var(--navigation-width);
10
+ height: 100vh;
11
+ overflow-y: auto;
12
+ padding: var(--space-base) 0;
13
+ z-index: var(--z-navigation);
14
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
15
+ font-weight: 400;
16
+ background-color: var(--color-nav-bg);
17
+ border-right: 1px solid var(--color-nav-border);
18
+ }
19
+
20
+ /* Navigation header */
21
+ #navigation h3 {
22
+ margin: 0 0 var(--space-sm) 0;
23
+ padding: 0 var(--space-base);
24
+ font-size: var(--font-size-sm);
25
+ font-weight: 600;
26
+ color: var(--color-nav-text);
27
+ }
28
+
29
+ /* Navigation list structure */
30
+ #navigation ul {
31
+ list-style: none;
32
+ padding: 0;
33
+ margin: 0;
34
+ }
35
+
36
+ #navigation li {
37
+ margin: 0;
38
+ }
39
+
40
+ /* Navigation links layout */
41
+ #navigation a {
42
+ display: block;
43
+ padding: var(--space-xs) var(--space-base);
44
+ text-decoration: none;
45
+ border-left: 2px solid transparent;
46
+ border-bottom: none;
47
+ transition: var(--transition-fast);
48
+ font-weight: 400;
49
+ color: var(--color-nav-text);
50
+ font-size: var(--font-size-sm);
51
+ }
52
+
53
+ #navigation a:hover {
54
+ color: var(--color-nav-text-hover);
55
+ background-color: var(--color-nav-bg-hover);
56
+ border-left-color: var(--color-nav-border);
57
+ }
58
+
59
+ #navigation a.current {
60
+ color: var(--color-nav-text-active);
61
+ background-color: var(--color-nav-bg-active);
62
+ border-left-color: var(--color-nav-border-active);
63
+ font-weight: 500;
64
+ }
65
+
66
+ /* Directory names (non-clickable) */
67
+ #navigation .directory-name {
68
+ display: block;
69
+ padding: var(--space-xs) var(--space-base);
70
+ font-weight: 600;
71
+ color: var(--color-nav-text-hover);
72
+ font-size: var(--font-size-xs);
73
+ }
74
+
75
+ /* Depth-based indentation */
76
+ #navigation .depth-0 a,
77
+ #navigation .depth-0 .directory-name {
78
+ padding-left: var(--space-base);
79
+ }
80
+
81
+ #navigation .depth-1 a,
82
+ #navigation .depth-1 .directory-name {
83
+ padding-left: calc(var(--space-base) * 2);
84
+ }
85
+
86
+ #navigation .depth-2 a,
87
+ #navigation .depth-2 .directory-name {
88
+ padding-left: calc(var(--space-base) * 3);
89
+ }
90
+
91
+ #navigation .depth-3 a,
92
+ #navigation .depth-3 .directory-name {
93
+ padding-left: calc(var(--space-base) * 4);
94
+ }
95
+
96
+ /* Container adjustments when navigation is present */
97
+ body:has(#navigation) #container {
98
+ margin-left: var(--navigation-width);
99
+ padding-left: var(--navigation-gap);
100
+ }
101
+
102
+ /* Fallback for browsers that don't support :has() */
103
+ @supports not selector(:has(#navigation)) {
104
+ body.has-navigation #container {
105
+ margin-left: var(--navigation-width);
106
+ padding-left: var(--navigation-gap);
107
+ }
108
+ }
109
+
110
+ /* Responsive navigation */
111
+ @media (max-width: 960px) {
112
+ #navigation {
113
+ position: static;
114
+ width: 100%;
115
+ height: auto;
116
+ border-right: none;
117
+ padding: var(--space-sm) 0;
118
+ }
119
+
120
+ body:has(#navigation) #container,
121
+ body.has-navigation #container {
122
+ margin-left: auto;
123
+ }
124
+ }
125
+
126
+ /* Hide navigation in print */
127
+ @media print {
128
+ #navigation {
129
+ display: none !important;
130
+ }
131
+
132
+ body:has(#navigation) #container,
133
+ body.has-navigation #container {
134
+ margin-left: auto !important;
135
+ }
136
+ }
@@ -0,0 +1,152 @@
1
+ /* Print Styles
2
+ * Shared print styles that all templates inherit
3
+ * Templates can override specific aspects while maintaining consistency
4
+ */
5
+
6
+ @media print {
7
+ /* Reset font sizes to print-optimized values */
8
+ :root {
9
+ --base-font-size: var(--print-font-size);
10
+ --base-line-height: var(--print-line-height);
11
+ --base-unit: calc(var(--print-font-size) * var(--print-line-height));
12
+ }
13
+
14
+ /* Force print-friendly colors */
15
+ body {
16
+ background-color: white !important;
17
+ color: #000 !important;
18
+ font-size: var(--print-font-size) !important;
19
+ line-height: var(--print-line-height) !important;
20
+ }
21
+
22
+ /* Hide navigation completely */
23
+ #navigation {
24
+ display: none !important;
25
+ }
26
+
27
+ /* Reset container for print */
28
+ #container,
29
+ body:has(#navigation) #container,
30
+ body.has-navigation #container {
31
+ margin: 0 !important;
32
+ padding: 0 !important;
33
+ max-width: none !important;
34
+ background-color: white !important;
35
+ box-shadow: none !important;
36
+ border: none !important;
37
+ border-radius: 0 !important;
38
+ }
39
+
40
+ /* Page break control */
41
+ h1, h2, h3, h4, h5, h6 {
42
+ page-break-after: avoid;
43
+ page-break-inside: avoid;
44
+ color: #000 !important;
45
+ }
46
+
47
+ /* Keep content together */
48
+ pre, blockquote, img, table, figure {
49
+ page-break-inside: avoid;
50
+ }
51
+
52
+ /* Orphans and widows control */
53
+ p, li, td, th {
54
+ widows: 3;
55
+ orphans: 3;
56
+ }
57
+
58
+ /* Links should be readable in print */
59
+ a {
60
+ color: #000 !important;
61
+ text-decoration: underline !important;
62
+ border-bottom: none !important;
63
+ }
64
+
65
+ /* Show URL after links (optional - can be overridden) */
66
+ a[href^="http"]:after {
67
+ content: " (" attr(href) ")";
68
+ font-size: 0.8em;
69
+ color: #666;
70
+ }
71
+
72
+ /* Code blocks */
73
+ code {
74
+ background-color: #f5f5f5 !important;
75
+ border: 1px solid #ddd !important;
76
+ border-radius: 0 !important;
77
+ color: #000 !important;
78
+ padding: 0.1em 0.3em !important;
79
+ }
80
+
81
+ pre {
82
+ background-color: #f8f8f8 !important;
83
+ border: 1px solid #ddd !important;
84
+ border-radius: 0 !important;
85
+ color: #000 !important;
86
+ white-space: pre-wrap !important;
87
+ word-wrap: break-word !important;
88
+ }
89
+
90
+ pre code {
91
+ background-color: transparent !important;
92
+ border: none !important;
93
+ padding: 0 !important;
94
+ }
95
+
96
+ /* Tables */
97
+ table {
98
+ background-color: white !important;
99
+ border-collapse: collapse !important;
100
+ width: 100% !important;
101
+ }
102
+
103
+ th, td {
104
+ border: 1px solid #000 !important;
105
+ padding: 0.3em 0.5em !important;
106
+ color: #000 !important;
107
+ background-color: transparent !important;
108
+ }
109
+
110
+ th {
111
+ background-color: #f0f0f0 !important;
112
+ font-weight: bold !important;
113
+ }
114
+
115
+ /* Blockquotes */
116
+ blockquote {
117
+ border-left: 3px solid #000 !important;
118
+ background-color: transparent !important;
119
+ color: #333 !important;
120
+ font-style: italic !important;
121
+ margin: 1em 0 !important;
122
+ padding: 0.5em 0 0.5em 1em !important;
123
+ }
124
+
125
+ /* Images */
126
+ img {
127
+ max-width: 100% !important;
128
+ height: auto !important;
129
+ display: block !important;
130
+ margin: 0.5em 0 !important;
131
+ }
132
+
133
+ /* Page margins and size */
134
+ @page {
135
+ margin: var(--print-margin);
136
+ size: letter;
137
+ }
138
+
139
+ /* First page special handling */
140
+ @page :first {
141
+ margin-top: calc(var(--print-margin) * 1.5);
142
+ }
143
+
144
+ /* Footnotes area if needed */
145
+ @page {
146
+ @bottom-right {
147
+ content: counter(page);
148
+ font-size: 0.8em;
149
+ color: #666;
150
+ }
151
+ }
152
+ }
@@ -1,4 +1,4 @@
1
- html, body, div, span, object, iframe,
1
+ html, body, div, span, object, iframe,
2
2
  h1, h2, h3, h4, h5, h6, p, blockquote, pre,
3
3
  abbr, address, cite, code,
4
4
  del, dfn, em, img, ins, kbd, q, samp,