@hgdc/agents 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.
package/dist/build.js CHANGED
@@ -75,10 +75,12 @@ export function markdownRoutes(pages, options) {
75
75
  // Pages dont le fichier ne suit pas `<chemin>.md` (racine, préfixe) : une route chacune.
76
76
  const special = pages.filter((p) => p.file !== `${p.path.slice(1)}.md`);
77
77
  const regular = pages.filter((p) => p.file === `${p.path.slice(1)}.md`);
78
- for (const group of chunks(pages.map((p) => escapeRegex(p.path))))
78
+ // L'accueil d'un préfixe arrive aussi avec la barre finale : `/agence/`, forme que relaie le site parent.
79
+ const pattern = (path) => (base && path === base ? `${escapeRegex(path)}/?` : escapeRegex(path));
80
+ for (const group of chunks(pages.map((p) => pattern(p.path))))
79
81
  before.push({ src: `^(?:${group})$`, headers: { Vary: "Accept" }, continue: true });
80
82
  for (const page of special) {
81
- const src = `^${escapeRegex(page.path)}$`;
83
+ const src = `^${pattern(page.path)}$`;
82
84
  const link = canonical(page.path === "/" ? "/" : page.path);
83
85
  before.push({
84
86
  src,
package/dist/markdown.js CHANGED
@@ -100,7 +100,9 @@ const hasClass = (el, pattern) => pattern.test(el.attrs.class ?? "");
100
100
  const hidden = (el) => DROPPED.has(el.tag) ||
101
101
  el.attrs["aria-hidden"] === "true" ||
102
102
  "hidden" in el.attrs ||
103
- hasClass(el, /(?:^|\s)(?:visually-hidden|sr-only|skip-link)(?:\s|$)/);
103
+ // `hidden` seul est la classe Tailwind `display: none` : l'autre moitié d'une image claire/sombre
104
+ // (`hidden dark:block`). `dark:hidden` ou `sm:hidden` ne comptent pas.
105
+ hasClass(el, /(?:^|\s)(?:visually-hidden|sr-only|skip-link|hidden)(?:\s|$)/);
104
106
  const hasBlock = (node) => typeof node !== "string" && !hidden(node) && (!INLINE.has(node.tag) || node.children.some(hasBlock));
105
107
  // Espaces ordinaires seulement : U+00A0 et U+202F (espace fine) sont des choix typographiques.
106
108
  const collapse = (text) => text.replace(/[ \t\n\r\f]+/g, " ");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hgdc/agents",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Sites lisibles par les agents IA : version Markdown des pages (Accept: text/markdown), 404 en Markdown, routes Build Output API pour les sites prérendus.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://github.com/hugogebel-boop/hgdc-kit/tree/main/packages/agents#readme",