generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
88 changed files
with
4,307 additions
and
2,187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
header { | ||
display: none; | ||
} | ||
|
||
.home { | ||
display: grid; | ||
position: relative; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// build-docs.mjs | ||
|
||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
import markdownIt from 'markdown-it'; | ||
import markdownItAttrs from 'markdown-it-attrs'; | ||
import markdownItAnchor from 'markdown-it-anchor'; | ||
import markdownItContainer from 'markdown-it-container'; | ||
import markdownItHighlightjs from 'markdown-it-highlightjs'; | ||
|
||
// Reconstruct __dirname and __filename in ES6 modules | ||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
|
||
const sourceFile = process.argv[2]; | ||
if (!sourceFile) { | ||
console.error('Please provide a source file as an argument'); | ||
process.exit(1); | ||
} | ||
|
||
const targetFile = process.argv[3]; | ||
if (!targetFile) { | ||
console.error('Please provide a target file as an argument'); | ||
process.exit(1); | ||
} | ||
|
||
const skipMas = process.argv.includes('--skip-mas'); | ||
|
||
// Initialize markdown-it with desired plugins | ||
const md = markdownIt({ | ||
html: true, | ||
linkify: true, | ||
typographer: true, | ||
}) | ||
.use(markdownItAttrs) | ||
.use(markdownItAnchor, { | ||
permalink: markdownItAnchor.permalink.headerLink(), | ||
}) | ||
.use(markdownItContainer, 'warning') | ||
.use(markdownItHighlightjs); | ||
|
||
// Define input and output paths | ||
const inputPath = path.join(__dirname, sourceFile); | ||
const outputPath = path.join(targetFile); | ||
|
||
// Read the Markdown file | ||
const inputContent = fs.readFileSync(inputPath, 'utf8'); | ||
|
||
// Render Markdown to HTML | ||
const htmlContent = md.render(inputContent); | ||
|
||
const masJs = skipMas | ||
? '' | ||
: '<script type="module" src="../../../deps/mas/mas.js"></script>'; | ||
|
||
// HTML template with your custom element script | ||
const htmlTemplate = ` | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Custom Element Documentation</title> | ||
<!-- Include your custom element script as an ES6 module --> | ||
<script src="../../../features/spectrum-web-components/dist/theme.js" type="module"></script> | ||
<script src="../../../features/spectrum-web-components/dist/button.js" type="module"></script> | ||
${masJs} | ||
<!-- Include Highlight.js stylesheet for syntax highlighting --> | ||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/default.min.css"> | ||
<!-- Include any additional stylesheets --> | ||
<link rel="stylesheet" href="styles.css"> | ||
</head> | ||
<body> | ||
<main> | ||
<sp-theme color="light" scale="medium"> | ||
${htmlContent} | ||
</sp-theme> | ||
</main> | ||
</body> | ||
</html> | ||
`; | ||
|
||
// Write the HTML file | ||
fs.writeFileSync(outputPath, htmlTemplate, 'utf8'); | ||
console.log('Documentation generated at', outputPath); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
# Build documentation for commerce/checkout-link.md and output to docs/checkout-link.html | ||
node build-docs.mjs commerce/checkout-link.md docs/checkout-link.html | ||
|
||
# Build documentation for mas/mas.md and output to docs/mas.html | ||
node build-docs.mjs mas/mas.md docs/mas.html | ||
|
||
# Build documentation for mas/mas.js.md and output to docs/mas.js.html, does not include mas.js in the generated html | ||
node build-docs.mjs mas/mas.js.md docs/mas.js.html --skip-mas |
Oops, something went wrong.