Skip to content

feat(converter): hand-port export files, add CodeBlock rule, and strip export const - #8445

Merged
PARTH-TUSSLE merged 2 commits into
hugofrom
feat/issue-8304-export-handports
Nov 19, 2026
Merged

PARTH-TUSSLE merged 2 commits into
hugofrom
feat/issue-8304-export-handports

Conversation

@PARTH-TUSSLE

Copy link
Copy Markdown
Contributor

Description

This PR addresses PR A of issue #8304:

  • Hand-ports data for the non-Sistent export files to hugo/data/handbook/*.yaml:
    • handbook/faq: faqData -> hugo/data/handbook/faq.yaml
    • handbook/mentorship-programs: programs_data -> hugo/data/handbook/mentorship_programs.yaml
    • handbook/repository-overview: repo_data -> hugo/data/handbook/repository_overview.yaml
    • handbook/recognition: badges-data -> hugo/data/handbook/badges.yaml
  • Adds theme-aware picture shortcodes for dark/light logos:
    • LfxLogoImage -> {{< lfx-logo >}} (hugo/layouts/shortcodes/lfx-logo.html)
    • ThemedScaLogo -> {{< themed-sca-logo >}} (hugo/layouts/shortcodes/themed-sca-logo.html)
  • Adds shortcode for JourneySection -> {{< journey-section >}} and partials for handbook data rendering.
  • Adds CodeBlock component mapping in COMPONENTS converting to fenced code blocks with language fallback.
  • Makes the converter strip export const statements deterministically outside code fences.
  • Adds unit tests in hugo/scripts/test/migrate-mdx.test.mjs (all 67 tests passing).

Part of #8304

…p export const

Part of #8304

Signed-off-by: PARTH-TUSSLE <parthgartan26feb@gmail.com>
@coderabbitai

coderabbitai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 64b7538f-92e7-47dc-a4b8-7a7d408be8b9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@miacycle miacycle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on this hand-port, the scope is clear and the new coverage is solid. I ran the converter suites at this head and all 67 tests pass (56 migrate-mdx, 8 bench-time, 3 verify-urls). The YAML keys line up with the new partials: badges has activity/projects/specials with name, image and description, faq has question/answer, and mentorship programs has name, description, buttonLink, image and imagePosition. Two things need attention before this lands, both called out inline below.

First, hugo/data/handbook/repository_overview.yaml does not parse: eight unquoted accessRequired: *... values are read as YAML aliases with no matching anchor, so the whole file fails to load and site.Data.handbook.repository_overview is unavailable. Quoting the values fixes it.

Second, the new logo shortcodes point at SVGs that are not under hugo/static: lfx-white.svg, Linux_Foundation_logo.svg, sca-dark.svg and sca.svg live only under src/collections/programs/..., and long-arrow.svg only under src/sections/Community/Newcomers-guide/. With relURL those will 404 unless the assets are copied into hugo/static or the converter copies them. Is that copy part of a follow-up PR, or should it ride along here?

One more note: the accessRequired field is not rendered by the new repository-overview partial, so dropping it is also an option if the source data does not need it preserved.

On tests and docs: the converter change ships with tests and they pass, so the test side of the gate is covered. No separate docs update looks needed for this website-side change.

- "https://layer5.io/community/members/aabid-sofi"
description: A collaborative, visual topology to design and operate cloud native infrastructure.
repository: "https://github.com/layer5labs/meshery-extensions"
accessRequired: *program participation required

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value breaks the whole data file: *program parses as a YAML alias with no matching anchor, so repository_overview.yaml fails to load and site.Data.handbook.repository_overview is unavailable. The same unquoted *... value appears on lines 108, 269, 306, 506, 516, 526, and 536. Quoting fixes it:

Suggested change
accessRequired: *program participation required
accessRequired: "*program participation required"

Comment on lines +410 to +432
let j = m.index + m[0].length;
let depth = 0, q = null, inLineComment = false, inBlockComment = false;
while (j < text.length) {
const c = text[j], next = text[j + 1];
if (inLineComment) { if (c === '\n') inLineComment = false; j++; continue; }
if (inBlockComment) { if (c === '*' && next === '/') { inBlockComment = false; j += 2; continue; } j++; continue; }
if (q) { if (c === '\\') { j += 2; continue; } if (c === q) { q = null; } j++; continue; }
if (c === '/' && next === '/') { inLineComment = true; j += 2; continue; }
if (c === '/' && next === '*') { inBlockComment = true; j += 2; continue; }
if (c === '"' || c === "'" || c === '`') { q = c; j++; continue; }
if (c === '{' || c === '[' || c === '(') { depth++; j++; continue; }
if (c === '}' || c === ']' || c === ')') { if (depth > 0) depth--; j++; continue; }
if (c === ';' && depth === 0) {
j++;
while (j < text.length && (text[j] === ' ' || text[j] === '\t')) j++;
if (j < text.length && text[j] === '\r') j++;
if (j < text.length && text[j] === '\n') j++;
break;
}
j++;
}
if (ctx?.count) ctx.count('exportsRemoved');
i = j;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified locally: when an export const has no terminating ;, the scan runs to end of text and everything after the export is silently dropped (stripExportConst('export const data = programs_data\n\nContent...') returns ''). Guard the strip so an unterminated statement is left in place; convertBody already warns on leftover exports:

Suggested change
let j = m.index + m[0].length;
let depth = 0, q = null, inLineComment = false, inBlockComment = false;
while (j < text.length) {
const c = text[j], next = text[j + 1];
if (inLineComment) { if (c === '\n') inLineComment = false; j++; continue; }
if (inBlockComment) { if (c === '*' && next === '/') { inBlockComment = false; j += 2; continue; } j++; continue; }
if (q) { if (c === '\\') { j += 2; continue; } if (c === q) { q = null; } j++; continue; }
if (c === '/' && next === '/') { inLineComment = true; j += 2; continue; }
if (c === '/' && next === '*') { inBlockComment = true; j += 2; continue; }
if (c === '"' || c === "'" || c === '`') { q = c; j++; continue; }
if (c === '{' || c === '[' || c === '(') { depth++; j++; continue; }
if (c === '}' || c === ']' || c === ')') { if (depth > 0) depth--; j++; continue; }
if (c === ';' && depth === 0) {
j++;
while (j < text.length && (text[j] === ' ' || text[j] === '\t')) j++;
if (j < text.length && text[j] === '\r') j++;
if (j < text.length && text[j] === '\n') j++;
break;
}
j++;
}
if (ctx?.count) ctx.count('exportsRemoved');
i = j;
let j = m.index + m[0].length;
let depth = 0, q = null, inLineComment = false, inBlockComment = false;
let terminated = false;
while (j < text.length) {
const c = text[j], next = text[j + 1];
if (inLineComment) { if (c === '\n') inLineComment = false; j++; continue; }
if (inBlockComment) { if (c === '*' && next === '/') { inBlockComment = false; j += 2; continue; } j++; continue; }
if (q) { if (c === '\\') { j += 2; continue; } if (c === q) { q = null; } j++; continue; }
if (c === '/' && next === '/') { inLineComment = true; j += 2; continue; }
if (c === '/' && next === '*') { inBlockComment = true; j += 2; continue; }
if (c === '"' || c === "'" || c === '`') { q = c; j++; continue; }
if (c === '{' || c === '[' || c === '(') { depth++; j++; continue; }
if (c === '}' || c === ']' || c === ')') { if (depth > 0) depth--; j++; continue; }
if (c === ';' && depth === 0) {
j++;
while (j < text.length && (text[j] === ' ' || text[j] === '\t')) j++;
if (j < text.length && text[j] === '\r') j++;
if (j < text.length && text[j] === '\n') j++;
break;
}
j++;
}
if (!terminated) {
// No terminator found: leave the statement in place instead of
// dropping the rest of the file; convertBody already warns on
// leftover `export` statements.
out += text.slice(m.index);
break;
}
if (ctx?.count) ctx.count('exportsRemoved');
i = j;

@pontusringblom

Copy link
Copy Markdown
Contributor

This is a good item to add to the weekly Websites meeting agenda (meet.meshery.io/websites-minutes). You can add this item in the doc, attend, and present it. Meeting details can be found at https://meshery.io/calendar.

…esolve shortcode svgs

Part of #8304

Signed-off-by: PARTH-TUSSLE <parthgartan26feb@gmail.com>
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Hugo preview removed because the pull request was closed.

@miacycle miacycle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, both items are fixed and verified: the eight unquoted accessRequired values in repository_overview.yaml are quoted now, and I confirmed the file parses; the logo SVGs live under hugo/static now and the shortcodes point at those paths, with a page-resource override kept. The unterminated export const guard is in place too, with a new test, and I ran the converter suites at this head: 68/68 pass. Checks are green.

I am leaving the merge for Mia's explicit call on this PR.

@PARTH-TUSSLE
PARTH-TUSSLE merged commit 10c27a3 into hugo Nov 19, 2026
5 checks passed
@PARTH-TUSSLE
PARTH-TUSSLE deleted the feat/issue-8304-export-handports branch November 19, 2026 08:14
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.

3 participants