@ozdao/scriptorium 0.1.0 → 0.1.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.
@@ -108,6 +108,12 @@ for (const config of Object.values(configs.ssr)) {
108
108
  config.resolve.alias['@docs-theme'] = docs_dir;
109
109
 
110
110
  config.module.rules.push(
111
+ // Картинки из .md, которых нет в правиле ассетов martyrs (там png, jpg, webp,
112
+ // svg…): avif — обычный формат референсов и скриншотов.
113
+ {
114
+ test: /\.avif$/i,
115
+ type: 'asset/resource',
116
+ },
111
117
  // .md репозитория → Vue-компонент страницы + frontmatter и заголовки.
112
118
  {
113
119
  test: /\.md$/,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ozdao/scriptorium",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Documentation site generator on @ozdao/martyrs: markdown folders to an SSR site",
5
5
  "author": "OZ DAO <hello@ozdao.com>",
6
6
  "license": "GPL-3.0-or-later",
@@ -103,7 +103,12 @@
103
103
  border-top: 1px solid var(--border-subtle);
104
104
  }
105
105
 
106
+ // Блочная: markdown кладёт картинку в <p>, а базовый стиль martyrs
107
+ // `p { text-box: cap alphabetic }` обрезает строку до метрик шрифта — абзац
108
+ // без текста схлопывается до высоты строчной буквы, и строчная картинка
109
+ // ложится поверх соседей. Блок выходит из строки, абзац берёт её высоту.
106
110
  img {
111
+ display: block;
107
112
  max-width: 100%;
108
113
  height: auto;
109
114
  }
package/src/server.js CHANGED
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
9
9
  import express from 'express';
10
10
  import cookies from 'cookie-parser';
11
11
 
12
- import { docs_dir, loadSiteConfig } from './content/scan.js';
12
+ import { docs_dir, docs_root, loadSiteConfig } from './content/scan.js';
13
13
 
14
14
  // Статика пакета: favicon по умолчанию.
15
15
  const package_public = fileURLToPath(new URL('../public', import.meta.url));
@@ -39,6 +39,15 @@ const createServer = async () => {
39
39
  app.use(express.static(path.join(docs_dir, 'public')));
40
40
  app.use(express.static(package_public));
41
41
 
42
+ // Файлы репозитория по ссылкам из документов (референсы, логотипы, манифест):
43
+ // как VitePress отдаёт всё из папки исходников. Только медиа и данные, без
44
+ // скрытых папок и node_modules: исходники и конфиги наружу не отдаются.
45
+ app.use((req, res, next) => {
46
+ if (!/\.(?:png|jpe?g|gif|webp|avif|svg|mp4|webm|pdf|json)$/i.test(req.path)) return next();
47
+ if (/\/\.|\/node_modules\//.test(req.path)) return next();
48
+ express.static(docs_root, { index: false, dotfiles: 'ignore' })(req, res, next);
49
+ });
50
+
42
51
  const server = http.createServer(app);
43
52
 
44
53
  // scriptorium start: SIGTERM (systemd, деплой) — штатный выход с кодом 0,