Skip to content

Feat/gitlab include placeholders#20

Merged
ebuildy merged 51 commits into
mainfrom
feat/gitlab-include-placeholders
Jul 1, 2026
Merged

Feat/gitlab include placeholders#20
ebuildy merged 51 commits into
mainfrom
feat/gitlab-include-placeholders

Conversation

@ebuildy

@ebuildy ebuildy commented Jun 30, 2026

Copy link
Copy Markdown
Owner

No description provided.

ebuildy and others added 6 commits June 29, 2026 18:23
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread src/include/out-processors.ts Fixed
ebuildy and others added 23 commits July 1, 2026 07:58
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
…e.ts

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
ebuildy and others added 21 commits July 1, 2026 07:58
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Avoids re-substituting placeholder text that appears inside an
already-rendered include body (e.g. a code file showing example syntax).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Wires the docusaurus-plugin-gitlab webpack loader into examples/site
alongside remark-gemoji, and asserts an {@includeGitlabReadme: ...}
placeholder flows through Docusaurus's native MDX pipeline (heading
anchors, emoji) rather than the JSX-component path.

This is the first time the loader runs inside a real Docusaurus build,
which surfaced three real bugs fixed along the way:

- src/options.ts: Docusaurus always injects an `id` field into a
  plugin's options object before invoking it (even without a
  validateOptions hook); the Joi schema rejected it as unknown.
- src/plugin/index.ts: registering our configureWebpack() rule
  without an explicit `include` caused Docusaurus core's synthetic
  MDX-fallback plugin (which flattens every .mdx? rule's `include`
  into its own `exclude`) to inject a literal `undefined` into that
  array; webpack-merge then turned it into `null` while wiring that
  plugin's result back in, which fails webpack's own config schema
  and aborts the build. Scoping `include` to siteDir fixes this at
  the root, and `mergeStrategy: { "module.rules": "append" }` avoids
  webpack-merge's default index-based rule merging corrupting other
  plugins' rules.
- src/gitlab/fetchers.ts: `./markdown` import was missing the
  required `.js` extension; harmless under bundler resolution but a
  hard ERR_MODULE_NOT_FOUND once the loader is loaded as a real
  Node/webpack-resolved module rather than bundled.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Rewrites CommonMark autolinks (<https://…>, <a@b.com>) in included GitLab
markdown into MDX-safe links so they don't abort the build, and exposes an
outProcessors option for custom markdown transforms. The built-in fix is
driven by a serializable flag so it reliably crosses the webpack loader
boundary; user functions are passed via an in-process registry keyed by a
stable id. Also hardens escapeMdx against stray '</' sequences.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
GitLab markdown uses HTML void elements without the self-closing slash
(<br>, <hr>, <img …>), which MDX rejects ('Expected a closing tag for <br>').
fixVoidTags self-closes them (<br> -> <br/>), code-aware and on by default
(disable with fixVoidTags: false). Driven by the same serializable flag as
fixAutolinks. Exported alongside fixAutolinks.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
…includes

A README's own 'Table of Contents' section duplicates the TOC Docusaurus renders
in the right sidebar. stripTableOfContents removes the TOC heading + its section
(up to the next same/higher-level heading) and any [[_TOC_]] marker, ignoring
headings inside code blocks. Opt-in via stripToc (default false) and exported
for manual composition.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
GitLab markdown's raw HTML uses string style attributes (style="color: red"),
but MDX/React require a style object ('The style prop expects a mapping … not a
string'). fixInlineStyles converts them to JSX style objects
(style={{ color: "red" }}), camelCasing properties (and quoting CSS custom
properties). Code-aware, on by default (disable with fixInlineStyles: false),
exported for manual composition.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
…nitions

Translates GitLab/GitHub alert blockquotes (> [!note], > [!warning], …) into
native Docusaurus admonitions (:::note … :::), so Docusaurus renders them as
themed callouts. Maps important->info and caution->danger, supports an optional
title, skips fenced code, and is on by default (disable with convertAlerts:
false). Exported for manual composition.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
CodeQL (js/polynomial-redos) flagged `/^\n+|\n+$/g` on the admonition body:
the `\n+$` alternative backtracks quadratically on input with many newlines
(a crafted/large alert blockquote is uncontrolled data). Replace it with a
linear character-scan trim of leading/trailing newlines; behavior is identical.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
…check)

The plugin-default-export packaging test imported "../dist/index.js" as a
string literal, so `tsc --noEmit` tried to resolve it — failing the typecheck
CI step, which runs before `dist/` is built. Import via a runtime URL instead;
behavior is unchanged and the file exists during `npm run test`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Thomas Decaux <ebuildy@gmail.com>
@ebuildy
ebuildy force-pushed the feat/gitlab-include-placeholders branch from f5de7bd to ebba1bc Compare July 1, 2026 05:58
@ebuildy
ebuildy merged commit d59a136 into main Jul 1, 2026
7 of 8 checks passed
@ebuildy
ebuildy deleted the feat/gitlab-include-placeholders branch July 1, 2026 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants