@@ -74,36 +74,8 @@ export function renderExamplesPage(examples) {
7474 } ) ;
7575}
7676
77- /**
78- * @param {Awaited<ReturnType<import('./examples-loader.js').loadTeaserExample>> } example
79- */
80- export function renderExamplesTeaser ( example ) {
81- return `
82- <div class="example-teaser">
83- <div>
84- <p class="eyebrow">runnable example</p>
85- <h3>${ escapeHtml ( example . title ) } </h3>
86- <p>${ escapeHtml ( example . intro || 'Open a complete example project with the data files, config, and commands together.' ) } </p>
87- </div>
88- <div class="button-row">
89- <a class="primary-link" href="./docs/examples.html">Browse examples</a>
90- <a href="${ escapeHtml ( example . githubUrl ) } " rel="noopener">Open on GitHub</a>
91- </div>
92- </div>
93- ` ;
94- }
95-
96- const TEASER_PLACEHOLDER = '<!-- @example-explorer -->' ;
97-
98- export function renderLandingWithTeaser ( landingHtml , teaserHtml ) {
99- if ( ! landingHtml . includes ( TEASER_PLACEHOLDER ) ) {
100- throw new Error ( `Landing page is missing the ${ TEASER_PLACEHOLDER } placeholder.` ) ;
101- }
102- // Function replacements avoid String.replace's special "$" substitution
103- // patterns, which could corrupt injected example file contents.
104- const withTeaser = landingHtml . replace ( TEASER_PLACEHOLDER , ( ) => teaserHtml ) ;
105- const withPagesLinks = withTeaser . replace ( / h r e f = " ( [ ^ " ] + ) " / gu, ( match , href ) => (
77+ export function renderLandingPage ( landingHtml ) {
78+ return landingHtml . replace ( / h r e f = " ( [ ^ " ] + ) " / gu, ( match , href ) => (
10679 `href="${ escapeHtml ( rewriteLandingSourceLink ( href ) ) } "`
10780 ) ) ;
108- return withPagesLinks ;
10981}
0 commit comments