Skip to content

Commit

Permalink
fix document generation
Browse files Browse the repository at this point in the history
  • Loading branch information
ECorreia45 committed Oct 28, 2024
1 parent 51aadbd commit 81c60ed
Show file tree
Hide file tree
Showing 12 changed files with 2,429 additions and 8,218 deletions.
File renamed without changes.
File renamed without changes.
4 changes: 1 addition & 3 deletions docs/_layouts/_head-meta.ts → docs/_layouts/_head-meta.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { PageProps } from '../../build-scripts/docs/types'

export default ({ title, description, name, path }: PageProps) => {
export default ({ title, description, name, path }) => {
return `
<meta charset="UTF-8" />
<meta
Expand Down
7 changes: 3 additions & 4 deletions docs/_layouts/_header.ts → docs/_layouts/_header.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import logo from './_logo'
import pkg from '../../package.json'
import { PageProps } from '../../build-scripts/docs/types'
import logo from './_logo.js'
import pkg from '../../package.json' with { type: 'json' }

export default ({ path }: PageProps) => `
export default ({ path }) => `
<header class="wrapper">
<h1>
<a href="/" aria-label="markup logo home link"
Expand Down
5 changes: 1 addition & 4 deletions docs/_layouts/_logo.ts → docs/_layouts/_logo.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
export default ({
fill = '#D2ECFF',
width = '80px',
}: { fill?: string; width?: string } = {}) => `
export default ({ fill = '#D2ECFF', width = '80px' } = {}) => `
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 207.25 61.99"
Expand Down
28 changes: 9 additions & 19 deletions docs/_layouts/document.ts → docs/_layouts/document.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
import {
PageProps,
SiteMap,
CustomOptions,
} from '../../build-scripts/docs/types'
import meta from './_head-meta'
import header from './_header'
import footer from './_footer'
import copyCode from './_copy-code'
import meta from './_head-meta.js'
import header from './_header.js'
import footer from './_footer.js'
import copyCode from './_copy-code.js'

const githubDocsPath =
'https://github.com/beforesemicolon/markup/tree/main/docs/documentation'

const navCategoryToHTML = (docs: SiteMap, currentPath: string) =>
const navCategoryToHTML = (docs, currentPath) =>
Array.from(docs.entries())
.map(([k, v]) => {
if (k.endsWith('.html')) {
const href = (v as CustomOptions).path.replace(
/(index)?\.html/,
''
)
const href = v.path.replace(/(index)?\.html/, '')

return `<li ${
currentPath === (v as CustomOptions).path
? 'class="active"'
: ''
}><a href="${href}">${(v as CustomOptions).name}</a></li>`
currentPath === v.path ? 'class="active"' : ''
}><a href="${href}">${v.name}</a></li>`
}

return `<ol><span>${k}</span>${navCategoryToHTML(
Expand All @@ -34,7 +24,7 @@ const navCategoryToHTML = (docs: SiteMap, currentPath: string) =>
})
.join('')

export default (props: PageProps) => {
export default (props) => {
const docs = props.siteMap.get('documentation')
const docsMenu = `<ul>${navCategoryToHTML(docs, props.path)}</ul>`

Expand Down
11 changes: 5 additions & 6 deletions docs/_layouts/landing.ts → docs/_layouts/landing.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { PageProps } from '../../build-scripts/docs/types'
import meta from './_head-meta'
import header from './_header'
import footer from './_footer'
import copyCode from './_copy-code'
import meta from './_head-meta.js'
import header from './_header.js'
import footer from './_footer.js'
import copyCode from './_copy-code.js'

export default (props: PageProps) => {
export default (props) => {
return `
<!doctype html>
<html lang="en">
Expand Down
5 changes: 2 additions & 3 deletions docs/documentation/templating/values.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,8 @@ All injected primitives will be rendered as their string version.

```javascript
html`
${0} ${true} ${false} ${34n} ${'sample'} ${undefined} ${null} ${Symbol(
'sample'
)}
${0} ${true} ${false} ${34n} ${'sample'} ${undefined} ${null}
${Symbol('sample')}
`.render(document.body)
// 0 true false 34 sample undefined null Symbol(sample)
```
Expand Down
Loading

0 comments on commit 81c60ed

Please sign in to comment.