midas-ssg 0.1.0__tar.gz

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 (48) hide show
  1. midas_ssg-0.1.0/LICENSE +21 -0
  2. midas_ssg-0.1.0/PKG-INFO +220 -0
  3. midas_ssg-0.1.0/README.md +203 -0
  4. midas_ssg-0.1.0/pyproject.toml +31 -0
  5. midas_ssg-0.1.0/setup.cfg +4 -0
  6. midas_ssg-0.1.0/src/midas/__init__.py +3 -0
  7. midas_ssg-0.1.0/src/midas/cli.py +81 -0
  8. midas_ssg-0.1.0/src/midas/core.py +486 -0
  9. midas_ssg-0.1.0/src/midas/defaults.py +48 -0
  10. midas_ssg-0.1.0/src/midas/starter/content/img/profile.png +0 -0
  11. midas_ssg-0.1.0/src/midas/starter/content/img/profile.webp +0 -0
  12. midas_ssg-0.1.0/src/midas/starter/content/img/watch.webp +0 -0
  13. midas_ssg-0.1.0/src/midas/starter/content/index.md +3 -0
  14. midas_ssg-0.1.0/src/midas/starter/content/posts/getting-started.md +162 -0
  15. midas_ssg-0.1.0/src/midas/starter/content/posts/midas-showcase.md +96 -0
  16. midas_ssg-0.1.0/src/midas/starter/midas.yaml +28 -0
  17. midas_ssg-0.1.0/src/midas/static/style.css +557 -0
  18. midas_ssg-0.1.0/src/midas/templates/base.html +58 -0
  19. midas_ssg-0.1.0/src/midas/templates/home.html +63 -0
  20. midas_ssg-0.1.0/src/midas/templates/icons/bluesky.svg +3 -0
  21. midas_ssg-0.1.0/src/midas/templates/icons/discord.svg +3 -0
  22. midas_ssg-0.1.0/src/midas/templates/icons/email.svg +3 -0
  23. midas_ssg-0.1.0/src/midas/templates/icons/facebook.svg +3 -0
  24. midas_ssg-0.1.0/src/midas/templates/icons/github.svg +3 -0
  25. midas_ssg-0.1.0/src/midas/templates/icons/gitlab.svg +3 -0
  26. midas_ssg-0.1.0/src/midas/templates/icons/linkedin.svg +3 -0
  27. midas_ssg-0.1.0/src/midas/templates/icons/mastodon.svg +3 -0
  28. midas_ssg-0.1.0/src/midas/templates/icons/paypal.svg +3 -0
  29. midas_ssg-0.1.0/src/midas/templates/icons/pinterest.svg +3 -0
  30. midas_ssg-0.1.0/src/midas/templates/icons/reddit.svg +4 -0
  31. midas_ssg-0.1.0/src/midas/templates/icons/spotify.svg +3 -0
  32. midas_ssg-0.1.0/src/midas/templates/icons/steam.svg +4 -0
  33. midas_ssg-0.1.0/src/midas/templates/icons/telegram.svg +3 -0
  34. midas_ssg-0.1.0/src/midas/templates/icons/threads-fill.svg +4 -0
  35. midas_ssg-0.1.0/src/midas/templates/icons/tiktok.svg +3 -0
  36. midas_ssg-0.1.0/src/midas/templates/icons/twitch.svg +4 -0
  37. midas_ssg-0.1.0/src/midas/templates/icons/twitter-x.svg +3 -0
  38. midas_ssg-0.1.0/src/midas/templates/icons/website.svg +3 -0
  39. midas_ssg-0.1.0/src/midas/templates/icons/youtube.svg +3 -0
  40. midas_ssg-0.1.0/src/midas/templates/page.html +10 -0
  41. midas_ssg-0.1.0/src/midas/templates/post-list.html +24 -0
  42. midas_ssg-0.1.0/src/midas/templates/post.html +22 -0
  43. midas_ssg-0.1.0/src/midas_ssg.egg-info/PKG-INFO +220 -0
  44. midas_ssg-0.1.0/src/midas_ssg.egg-info/SOURCES.txt +46 -0
  45. midas_ssg-0.1.0/src/midas_ssg.egg-info/dependency_links.txt +1 -0
  46. midas_ssg-0.1.0/src/midas_ssg.egg-info/entry_points.txt +2 -0
  47. midas_ssg-0.1.0/src/midas_ssg.egg-info/requires.txt +4 -0
  48. midas_ssg-0.1.0/src/midas_ssg.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Niila Viinamäki
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 all
13
+ 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 THE
21
+ SOFTWARE.
@@ -0,0 +1,220 @@
1
+ Metadata-Version: 2.4
2
+ Name: midas-ssg
3
+ Version: 0.1.0
4
+ Summary: A minimal, opinionated static site generator
5
+ Author: Niila Viinamäki
6
+ License: MIT
7
+ Project-URL: Homepage, https://midas.niila.fi
8
+ Project-URL: Repository, https://github.com/vike256/Midas
9
+ Requires-Python: >=3.9
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: markdown>=3.5
13
+ Requires-Dist: Pygments>=2.16
14
+ Requires-Dist: Jinja2>=3.1
15
+ Requires-Dist: PyYAML>=6.0
16
+ Dynamic: license-file
17
+
18
+ # Midas
19
+
20
+ A minimal, opinionated static site generator. Drop markdown files into a folder, run one command, and get a clean, fast, multilingual website.
21
+
22
+ ## Features
23
+
24
+ - **Zero config** for single-language sites
25
+ - **Markdown** with syntax highlighting, tables, and strikethrough
26
+ - **Multilingual** support as a first-class feature
27
+ - **RSS feeds** per language
28
+ - **Built-in templates and CSS** that update with the package
29
+ - **Jinja2 templates** — optional override for power users
30
+ - **Built-in dev server** — no extra tools needed
31
+
32
+ ## Installation
33
+
34
+ Requires Python 3.9 or newer.
35
+
36
+ ```bash
37
+ pip install midas-ssg
38
+ ```
39
+
40
+ Or install from source in editable mode for development:
41
+
42
+ ```bash
43
+ pip install -e .
44
+ ```
45
+
46
+ This installs the `midas` command-line tool.
47
+
48
+ ## Quick start
49
+
50
+ ```bash
51
+ midas init my-blog
52
+ cd my-blog
53
+ midas serve
54
+ ```
55
+
56
+ Open `http://localhost:8000` to see your site.
57
+
58
+ ## Commands
59
+
60
+ | Command | Description |
61
+ |---|---|
62
+ | `midas init <folder>` | Scaffold a new Midas project into `<folder>`. Requires an empty directory. |
63
+ | `midas init` | Scaffold a new Midas project into the current directory. Also requires an empty directory. |
64
+ | `midas build` | Build the site to `dist/`. |
65
+ | `midas serve` | Build and start a local development server on `http://localhost:8000`. |
66
+ | `midas clean` | Delete the `dist/` folder. |
67
+
68
+ ## Directory structure
69
+
70
+ After `midas init`, your project looks like this:
71
+
72
+ ```
73
+ my-blog/
74
+ ├── midas.yaml # Site configuration
75
+ ├── style.css # Optional CSS overrides (empty by default)
76
+ ├── content/ # Your markdown content
77
+ │ ├── index.md # Homepage
78
+ │ ├── posts/ # Blog posts
79
+ │ └── img/ # Images (copied as-is)
80
+ └── static/ # Other static assets (favicons, fonts, etc.)
81
+ ```
82
+
83
+ The built site is written to `dist/`.
84
+
85
+ ## How it works
86
+
87
+ ### Templates
88
+
89
+ Midas ships with built-in Jinja2 templates (`base.html`, `home.html`, `post.html`, etc.) that live inside the installed package. When you update Midas (`pip install -U midas`), your site's HTML updates automatically.
90
+
91
+ You never have to touch HTML. If you want to customize a template, create a `templates/` folder in your project and copy only the files you want to override. Midas will use your version instead of the built-in one, but you'll stop receiving updates for those specific templates.
92
+
93
+ ### Styles
94
+
95
+ Midas provides a built-in light minimalist stylesheet. It is copied to `dist/midas.css` on every build.
96
+
97
+ To customize styles, edit the `style.css` file at your project root. It is copied to `dist/style.css` and loaded **after** `midas.css`, so any rule you write overrides the base. Keep your overrides minimal — only change what you need.
98
+
99
+ For other assets (favicons, fonts, PDFs), drop them into `static/` and they are copied to `dist/`.
100
+
101
+ ## Writing content
102
+
103
+ ### Blog posts
104
+
105
+ Create a markdown file in `content/posts/`:
106
+
107
+ ```markdown
108
+ ---
109
+ title: "Hello World"
110
+ description: "My first post"
111
+ date: 2025-01-01
112
+ ---
113
+
114
+ Your post content here.
115
+ ```
116
+
117
+ Posts are sorted by date. The filename can also include a date prefix: `2025-01-01-hello-world.md`.
118
+
119
+ ### Standalone pages
120
+
121
+ Any `.md` file outside `posts/` becomes a page:
122
+
123
+ ```markdown
124
+ ---
125
+ title: "About"
126
+ ---
127
+
128
+ This is the about page.
129
+ ```
130
+
131
+ ### Homepage
132
+
133
+ `content/index.md` with `type: home` becomes the homepage. You can put metadata in its frontmatter or in `midas.yaml` under `home:`.
134
+
135
+ ### Multilingual content
136
+
137
+ Add languages in `midas.yaml`:
138
+
139
+ ```yaml
140
+ languages:
141
+ default: en
142
+ additional: [fi]
143
+ ```
144
+
145
+ Then create content in `content/fi/posts/` for Finnish posts. Frontmatter `language` takes priority over folder inference.
146
+
147
+ ## Configuration
148
+
149
+ `midas.yaml` is optional but recommended:
150
+
151
+ ```yaml
152
+ site:
153
+ url: "https://example.com"
154
+ name: "My Site"
155
+ description: "A personal website"
156
+ copyright: "© 2024 Your Name"
157
+
158
+ languages:
159
+ default: en
160
+ additional: [fi]
161
+
162
+ home:
163
+ name: "Your Name"
164
+ bio: "A short description about you."
165
+ profilePic: "/img/profile.webp"
166
+ socials:
167
+ - name: github
168
+ url: "https://github.com/yourusername"
169
+ - name: email
170
+ url: "mailto:hello@example.com"
171
+ cards:
172
+ - title: "My Project"
173
+ url: "https://example.com/project"
174
+
175
+ recentPosts: 3
176
+ ```
177
+
178
+ ## Customization
179
+
180
+ ### CSS overrides
181
+
182
+ Edit `style.css` at your project root. For example, to switch to a dark background:
183
+
184
+ ```css
185
+ body {
186
+ background: #1a1a1a;
187
+ color: #fafafa;
188
+ }
189
+ ```
190
+
191
+ ### Template overrides
192
+
193
+ Create a `templates/` folder and drop in only the files you want to override. For example, to customize the homepage:
194
+
195
+ ```bash
196
+ mkdir templates
197
+ cp $(python -c "import midas; print(midas.__file__)")/../templates/home.html templates/
198
+ ```
199
+
200
+ Then edit `templates/home.html`. When you run `midas build`, you'll see a warning:
201
+
202
+ ```
203
+ Templates overridden: home.html
204
+ These will not receive updates from Midas automatically.
205
+ ```
206
+
207
+ ### Icons
208
+
209
+ The built-in `home.html` template renders social icons by looking up SVG files in `templates/icons/` by name. If you create a `templates/icons/` folder in your project, you can add or replace icons there.
210
+
211
+ ## Dependencies
212
+
213
+ - [markdown](https://pypi.org/project/Markdown/) — Markdown parsing
214
+ - [Pygments](https://pygments.org/) — Syntax highlighting
215
+ - [Jinja2](https://jinja.palletsprojects.com/) — Templating
216
+ - [PyYAML](https://pyyaml.org/) — YAML parsing
217
+
218
+ ## License
219
+
220
+ MIT
@@ -0,0 +1,203 @@
1
+ # Midas
2
+
3
+ A minimal, opinionated static site generator. Drop markdown files into a folder, run one command, and get a clean, fast, multilingual website.
4
+
5
+ ## Features
6
+
7
+ - **Zero config** for single-language sites
8
+ - **Markdown** with syntax highlighting, tables, and strikethrough
9
+ - **Multilingual** support as a first-class feature
10
+ - **RSS feeds** per language
11
+ - **Built-in templates and CSS** that update with the package
12
+ - **Jinja2 templates** — optional override for power users
13
+ - **Built-in dev server** — no extra tools needed
14
+
15
+ ## Installation
16
+
17
+ Requires Python 3.9 or newer.
18
+
19
+ ```bash
20
+ pip install midas-ssg
21
+ ```
22
+
23
+ Or install from source in editable mode for development:
24
+
25
+ ```bash
26
+ pip install -e .
27
+ ```
28
+
29
+ This installs the `midas` command-line tool.
30
+
31
+ ## Quick start
32
+
33
+ ```bash
34
+ midas init my-blog
35
+ cd my-blog
36
+ midas serve
37
+ ```
38
+
39
+ Open `http://localhost:8000` to see your site.
40
+
41
+ ## Commands
42
+
43
+ | Command | Description |
44
+ |---|---|
45
+ | `midas init <folder>` | Scaffold a new Midas project into `<folder>`. Requires an empty directory. |
46
+ | `midas init` | Scaffold a new Midas project into the current directory. Also requires an empty directory. |
47
+ | `midas build` | Build the site to `dist/`. |
48
+ | `midas serve` | Build and start a local development server on `http://localhost:8000`. |
49
+ | `midas clean` | Delete the `dist/` folder. |
50
+
51
+ ## Directory structure
52
+
53
+ After `midas init`, your project looks like this:
54
+
55
+ ```
56
+ my-blog/
57
+ ├── midas.yaml # Site configuration
58
+ ├── style.css # Optional CSS overrides (empty by default)
59
+ ├── content/ # Your markdown content
60
+ │ ├── index.md # Homepage
61
+ │ ├── posts/ # Blog posts
62
+ │ └── img/ # Images (copied as-is)
63
+ └── static/ # Other static assets (favicons, fonts, etc.)
64
+ ```
65
+
66
+ The built site is written to `dist/`.
67
+
68
+ ## How it works
69
+
70
+ ### Templates
71
+
72
+ Midas ships with built-in Jinja2 templates (`base.html`, `home.html`, `post.html`, etc.) that live inside the installed package. When you update Midas (`pip install -U midas`), your site's HTML updates automatically.
73
+
74
+ You never have to touch HTML. If you want to customize a template, create a `templates/` folder in your project and copy only the files you want to override. Midas will use your version instead of the built-in one, but you'll stop receiving updates for those specific templates.
75
+
76
+ ### Styles
77
+
78
+ Midas provides a built-in light minimalist stylesheet. It is copied to `dist/midas.css` on every build.
79
+
80
+ To customize styles, edit the `style.css` file at your project root. It is copied to `dist/style.css` and loaded **after** `midas.css`, so any rule you write overrides the base. Keep your overrides minimal — only change what you need.
81
+
82
+ For other assets (favicons, fonts, PDFs), drop them into `static/` and they are copied to `dist/`.
83
+
84
+ ## Writing content
85
+
86
+ ### Blog posts
87
+
88
+ Create a markdown file in `content/posts/`:
89
+
90
+ ```markdown
91
+ ---
92
+ title: "Hello World"
93
+ description: "My first post"
94
+ date: 2025-01-01
95
+ ---
96
+
97
+ Your post content here.
98
+ ```
99
+
100
+ Posts are sorted by date. The filename can also include a date prefix: `2025-01-01-hello-world.md`.
101
+
102
+ ### Standalone pages
103
+
104
+ Any `.md` file outside `posts/` becomes a page:
105
+
106
+ ```markdown
107
+ ---
108
+ title: "About"
109
+ ---
110
+
111
+ This is the about page.
112
+ ```
113
+
114
+ ### Homepage
115
+
116
+ `content/index.md` with `type: home` becomes the homepage. You can put metadata in its frontmatter or in `midas.yaml` under `home:`.
117
+
118
+ ### Multilingual content
119
+
120
+ Add languages in `midas.yaml`:
121
+
122
+ ```yaml
123
+ languages:
124
+ default: en
125
+ additional: [fi]
126
+ ```
127
+
128
+ Then create content in `content/fi/posts/` for Finnish posts. Frontmatter `language` takes priority over folder inference.
129
+
130
+ ## Configuration
131
+
132
+ `midas.yaml` is optional but recommended:
133
+
134
+ ```yaml
135
+ site:
136
+ url: "https://example.com"
137
+ name: "My Site"
138
+ description: "A personal website"
139
+ copyright: "© 2024 Your Name"
140
+
141
+ languages:
142
+ default: en
143
+ additional: [fi]
144
+
145
+ home:
146
+ name: "Your Name"
147
+ bio: "A short description about you."
148
+ profilePic: "/img/profile.webp"
149
+ socials:
150
+ - name: github
151
+ url: "https://github.com/yourusername"
152
+ - name: email
153
+ url: "mailto:hello@example.com"
154
+ cards:
155
+ - title: "My Project"
156
+ url: "https://example.com/project"
157
+
158
+ recentPosts: 3
159
+ ```
160
+
161
+ ## Customization
162
+
163
+ ### CSS overrides
164
+
165
+ Edit `style.css` at your project root. For example, to switch to a dark background:
166
+
167
+ ```css
168
+ body {
169
+ background: #1a1a1a;
170
+ color: #fafafa;
171
+ }
172
+ ```
173
+
174
+ ### Template overrides
175
+
176
+ Create a `templates/` folder and drop in only the files you want to override. For example, to customize the homepage:
177
+
178
+ ```bash
179
+ mkdir templates
180
+ cp $(python -c "import midas; print(midas.__file__)")/../templates/home.html templates/
181
+ ```
182
+
183
+ Then edit `templates/home.html`. When you run `midas build`, you'll see a warning:
184
+
185
+ ```
186
+ Templates overridden: home.html
187
+ These will not receive updates from Midas automatically.
188
+ ```
189
+
190
+ ### Icons
191
+
192
+ The built-in `home.html` template renders social icons by looking up SVG files in `templates/icons/` by name. If you create a `templates/icons/` folder in your project, you can add or replace icons there.
193
+
194
+ ## Dependencies
195
+
196
+ - [markdown](https://pypi.org/project/Markdown/) — Markdown parsing
197
+ - [Pygments](https://pygments.org/) — Syntax highlighting
198
+ - [Jinja2](https://jinja.palletsprojects.com/) — Templating
199
+ - [PyYAML](https://pyyaml.org/) — YAML parsing
200
+
201
+ ## License
202
+
203
+ MIT
@@ -0,0 +1,31 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "midas-ssg"
7
+ version = "0.1.0"
8
+ description = "A minimal, opinionated static site generator"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.9"
12
+ authors = [{name = "Niila Viinamäki"}]
13
+ dependencies = [
14
+ "markdown>=3.5",
15
+ "Pygments>=2.16",
16
+ "Jinja2>=3.1",
17
+ "PyYAML>=6.0",
18
+ ]
19
+
20
+ [project.urls]
21
+ Homepage = "https://midas.niila.fi"
22
+ Repository = "https://github.com/vike256/Midas"
23
+
24
+ [project.scripts]
25
+ midas = "midas.cli:main"
26
+
27
+ [tool.setuptools.packages.find]
28
+ where = ["src"]
29
+
30
+ [tool.setuptools.package-data]
31
+ midas = ["starter/**/*", "templates/**/*", "static/**/*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """Midas — a minimal, opinionated static site generator."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,81 @@
1
+ """
2
+ Midas — CLI entry point.
3
+ """
4
+
5
+ import argparse
6
+ import shutil
7
+ import sys
8
+ from pathlib import Path
9
+
10
+ from importlib.resources import files
11
+
12
+ from .core import build, serve, DIST_DIR
13
+ from .defaults import load_config
14
+
15
+
16
+ def _copy_tree(src, dst: Path) -> None:
17
+ """Recursively copy from importlib.resources Traversable to Path."""
18
+ for item in src.iterdir():
19
+ target = dst / item.name
20
+ if item.is_dir():
21
+ target.mkdir(exist_ok=True)
22
+ _copy_tree(item, target)
23
+ else:
24
+ target.write_bytes(item.read_bytes())
25
+
26
+
27
+ STYLE_CSS_HEADER = """/* Override Midas base styles here.
28
+ This file is loaded after midas.css, so any rule here wins.
29
+ Delete this file if you don't need custom styles.
30
+ */
31
+ """
32
+
33
+
34
+ def init_project(target: Path) -> None:
35
+ if target.exists() and any(target.iterdir()):
36
+ print(f"Error: {target} is not empty. Midas init requires an empty directory.")
37
+ print("Existing files in directory:")
38
+ for item in target.iterdir():
39
+ marker = " (dir)" if item.is_dir() else ""
40
+ print(f" {item.name}{marker}")
41
+ sys.exit(1)
42
+
43
+ target.mkdir(parents=True, exist_ok=True)
44
+ starter = files("midas") / "starter"
45
+ _copy_tree(starter, target)
46
+
47
+ # Scaffold empty override files
48
+ (target / "style.css").write_text(STYLE_CSS_HEADER, encoding="utf-8")
49
+ (target / "static").mkdir(exist_ok=True)
50
+
51
+ print(f"Initialized Midas project in {target}")
52
+
53
+
54
+ def main() -> None:
55
+ parser = argparse.ArgumentParser(description="Midas — static site generator")
56
+ subparsers = parser.add_subparsers(dest="command", required=True)
57
+
58
+ init_parser = subparsers.add_parser("init", help="Initialize a new Midas project")
59
+ init_parser.add_argument("folder", nargs="?", default=".", help="Target directory")
60
+
61
+ subparsers.add_parser("build", help="Build the site to dist/")
62
+ subparsers.add_parser("serve", help="Build and serve on localhost:8000")
63
+ subparsers.add_parser("clean", help="Wipe dist/")
64
+
65
+ args = parser.parse_args()
66
+
67
+ if args.command == "init":
68
+ init_project(Path(args.folder))
69
+ return
70
+
71
+ if args.command == "clean":
72
+ if DIST_DIR.exists():
73
+ shutil.rmtree(DIST_DIR)
74
+ print("Cleaned dist/")
75
+ return
76
+
77
+ config = load_config()
78
+ build(config)
79
+
80
+ if args.command == "serve":
81
+ serve()