| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a0953d3 commit 600ae56
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -159,18 +159,21 @@ cd showcase && pnpm run watch | |||
| 159 | 159 | ||
| 160 | 160 | ### Markdown Pipeline | |
| 161 | 161 | ||
| 162 | - The `markdown` script transforms `showcase/markdown/*.md` files into JSON: | ||
| 162 | + The `markdown` script recursively walks `showcase/markdown/` and transforms `.md` files into JSON: | ||
| 163 | 163 | ||
| 164 | 164 | 1. Parses markdown with remark (GFM + frontmatter support) | |
| 165 | - 2. Extracts YAML frontmatter (`id`, `title`) | ||
| 165 | + 2. Extracts YAML frontmatter (`id`, `title`, `order`) | ||
| 166 | 166 | 3. Generates a table of contents from h2/h3 headings | |
| 167 | 167 | 4. Converts to HTML with rehype | |
| 168 | 168 | 5. Adds slug IDs and autolinks to headings | |
| 169 | 169 | 6. Applies PatternFly CSS classes to headings | |
| 170 | 170 | 7. Syntax-highlights code blocks (Java, XML, JavaScript, JSON, HTML, CSS, Bash) | |
| 171 | - 8. Writes JSON to `showcase/src/web/markdown/{id}.json` | ||
| 171 | + 8. Writes JSON to `showcase/src/web/markdown/`, preserving the directory structure | ||
| 172 | + 9. Generates `showcase/src/web/markdown/manifest.json` with the navigation tree | ||
| 172 | 173 | ||
| 173 | - The Vite dev server watches the `markdown/` directory and regenerates JSON on changes. During a Maven `package` build, the `pnpm run markdown` command is executed automatically in the `prepare-package` phase via the frontend-maven-plugin. | ||
| 174 | + The Vite dev server watches the `markdown/` directory for changes, additions, and deletions (`.md` and `.yaml` files) and regenerates JSON automatically. During a Maven `package` build, `pnpm run markdown` runs automatically in the `prepare-package` phase. | ||
| 175 | + | ||
| 176 | + See the [Documentation](/developer/documentation) page for details on the directory structure, frontmatter fields, and folder conventions. | ||
| 174 | 177 | ||
| 175 | 178 | ### Full Showcase Build | |
| 176 | 179 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -41,18 +41,36 @@ function serveJ2cl() { | |||
| 41 | 41 | } | |
| 42 | 42 | ||
| 43 | 43 | function markdownPlugin() { | |
| 44 | + let reprocessing = false; | ||
| 45 | + | ||
| 46 | + function reprocess() { | ||
| 47 | + if (reprocessing) return; | ||
| 48 | + reprocessing = true; | ||
| 49 | + try { | ||
| 50 | + execSync('node markdown.mjs', {stdio: 'inherit'}); | ||
| 51 | + } finally { | ||
| 52 | + reprocessing = false; | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + function isMarkdownSource(file) { | ||
| 57 | + return file.startsWith(markdownDir) && (file.endsWith('.md') || file.endsWith('.yaml')); | ||
| 58 | + } | ||
| 59 | + | ||
| 44 | 60 | return { | |
| 45 | 61 | name: 'markdown', | |
| 46 | 62 | buildStart() { | |
| 47 | - execSync('node markdown.mjs', {stdio: 'inherit'}); | ||
| 63 | + reprocess(); | ||
| 48 | 64 | }, | |
| 49 | 65 | configureServer(server) { | |
| 50 | 66 | server.watcher.add(markdownDir); | |
| 51 | - server.watcher.on('change', (file) => { | ||
| 52 | - if (file.startsWith(markdownDir) && file.endsWith('.md')) { | ||
| 53 | - execSync('node markdown.mjs', {stdio: 'inherit'}); | ||
| 54 | - } | ||
| 55 | - }); | ||
| 67 | + for (const event of ['change', 'add', 'unlink']) { | ||
| 68 | + server.watcher.on(event, (file) => { | ||
| 69 | + if (isMarkdownSource(file)) { | ||
| 70 | + reprocess(); | ||
| 71 | + } | ||
| 72 | + }); | ||
| 73 | + } | ||
| 56 | 74 | } | |
| 57 | 75 | }; | |
| 58 | 76 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments