Skip to content

Commit

Permalink
docs: convert to vitepress
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 committed Dec 16, 2023
1 parent 339f9ef commit 3bb388b
Show file tree
Hide file tree
Showing 67 changed files with 4,948 additions and 9,774 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
run: npm ci

# run build script
- name: Build VuePress site
- name: Build Site
run: npm run build

# please check out the docs of the workflow for more details
Expand All @@ -48,8 +48,7 @@ jobs:
with:
# deploy to gh-pages branch
target_branch: gh-pages
# deploy the default output of VuePress
build_dir: docs/.vuepress/dist/Coalesce
build_dir: docs/.vitepress/dist/Coalesce
jekyll: false
env:
# @see https://docs.github.com/en/actions/reference/authentication-in-a-workflow#about-the-github_token-secret
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ docs_old/
#vuepress
.cache/
.temp/
**/.vitepress/cache/


## Ignore Visual Studio temporary files, build results, and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,23 @@
.code-tabs__nav {
margin-top: 0.85rem;
// 2 * margin + border-radius of <pre> tag
margin-bottom: calc(-1.7rem - 6px);
padding-bottom: calc(1.7rem - 6px);
margin-bottom: -20px;
padding-left: 10px;
padding-top: 10px;
border-top-left-radius: 6px;
border-top-right-radius: 6px;
background-color: var(--code-bg-color);
background-color: var(--vp-code-block-bg);
}
.code-tabs__ul {
margin: auto 0px;
margin-bottom: 5px;
padding-left: 0;
display: inline-flex;
list-style: none;
list-style: none !important;
}
.code-tabs__li {
margin-top: 0 !important;
}
.code-tabs__nav-tab {
Expand All @@ -78,7 +80,7 @@
}
.code-tabs__nav-tab-active {
border-bottom: var(--c-brand) 2px solid;
border-bottom: var(--vp-c-brand-1) 2px solid;
}
@media (max-width: 500px) {
Expand All @@ -91,14 +93,14 @@
.code-tabs-item {
color: #adbac7;
background-color: var(--code-bg-color);
background-color: var(--vp-code-block-bg);
div[class*=language-]::before {
top: 5px;
}
// Give some horizontal padding to items that arent code
> :not(.line-numbers-mode) {
padding: 0 20px
> :not([class*='language-']) {
padding: 0 24px
}
pre, pre + div {
Expand All @@ -113,7 +115,7 @@
<script>
// Code tabs plugin inspired by
// https://github.com/padarom/vuepress-plugin-code-switcher,
// updated to work with Vuepress2/Vue3.
// updated to work with Vitepress.
import { reactive, effect } from 'vue'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
</h4>
<h4 v-else class="code-prop" :id="idAttr">
<!-- Temporary uncolored content that matches the result as best as possible to avoid FOUC -->
<pre class="shiki" style="background-color: #1E1E1E; line-height: 1.18; padding-top: 1px; padding-bottom: 4px;">
<pre class="shiki" style="line-height: 1.18; padding-top: 1px; padding-bottom: 4px;">
<code>
{{def}}
</code>
Expand All @@ -13,12 +13,19 @@


<style lang="scss">
p + .code-prop {
margin-top: 36px;
}
.code-prop {
margin-top: 10px;
.shiki {
margin: 0;
padding: 2px 8px;
white-space: normal;
background-color: var(--vp-code-block-bg) !important;
border-radius: 5px;
.line {
display: block;
white-space: pre-wrap;
Expand Down Expand Up @@ -121,7 +128,7 @@ export default defineComponent({
methods: {
async renderHtml() {
var ctorDesc = null;
var ctorDesc: string | null = null;
if (this.ctor) {
ctorDesc = '// Also settable via constructor parameter #' + this.ctor;
Expand Down Expand Up @@ -167,7 +174,7 @@ export default defineComponent({
.replace(/[ &<>"']/g,'-')
.replace(/\$/g,'_')
const { highlighter, shiki } = await getHighlighter(this.lang);
const { highlighter, shiki } = await getHighlighter(this.lang)!;
const tokens = highlighter.codeToThemedTokens(code, this.lang)
if (!this.noClass) {
Expand All @@ -182,7 +189,7 @@ export default defineComponent({
bg: theme.bg
})
this.html = `<a class="header-anchor" href="#${this.idAttr}" aria-hidden="true">#</a>${html}`;
this.html = `<a class="header-anchor" href="#${this.idAttr}" aria-hidden="true"></a>${html}`;
}
}
});
Expand Down
62 changes: 62 additions & 0 deletions docs/.vitepress/components/SiteFooter.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<template>
<footer class="vp-doc intellitect-footer">
<hr style="margin: 70px 0" />
<div class="content">
<a href="https://www.intellitect.com">
<img class="dark-only" src="/intellitect-text-white.svg" />

<img class="light-only" src="/intellitect-text-black.svg" />
</a>
<p>
Coalesce is a free and open-source framework created by
<a href="https://intellitect.com" target="_blank" rel="noreferrer">
IntelliTect
</a>
to fill our desire to create better apps, faster. IntelliTect is a
high-end software architecture and development consulting firm based in
Spokane, Washington.
</p>
<p>
If you're looking for help with your software project, whether it be a
Coalesce application, other technologies, or even just an idea, reach
out to us at
<a href="mailto:[email protected]">[email protected]</a> — we'd
love to start a conversation!
<a
href="https://intellitect.com/our-clients/"
target="_blank"
rel="noreferrer"
>
Our clients
</a>
range from Fortune 100 companies to local small businesses and
non-profits. There is no job too big or small!
</p>
</div>
</footer>
</template>

<style lang="scss">
.intellitect-footer {
margin: auto;
text-align: center;
img {
max-height: 6ex;
margin: auto;
}
> .content {
margin: auto;
max-width: 800px;
}
&.page-footer {
hr {
margin-bottom: 20px !important;
}
font-size: 14px;
* {
line-height: 1.75 !important;
}
}
}
</style>
175 changes: 175 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
import { defineConfig } from "vitepress";
import { registerImportMdPlugin } from "./importMdPlugin";

import path from "path";
import fs from "fs";
import url from "url";
import matter from "gray-matter";

function autoTitle(link: string) {
const fullPath = path.join(
url.fileURLToPath(import.meta.url),
"../../",
link + (path.extname(link) ? "" : ".md")
);

const { data, content } = matter(fs.readFileSync(fullPath));

// Check if title exists in frontmatter
if (data && data.title && typeof data.title === "string") {
return { text: data.title, link };
}

// If title is not in frontmatter, try to find the first H1 heading
const h1Match = content.match(/^#\s+(.+)/m);
if (h1Match && h1Match[1] && typeof h1Match[1] === "string") {
return { text: h1Match[1], link };
}

throw Error("Cannot find a title for " + link);
}

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "Coalesce",
description: "Documentation for Coalesce by IntelliTect",
base: "/Coalesce/",
head: [["link", { rel: "shortcut icon", href: "/Coalesce/favicon.ico" }]],
markdown: {
config(md) {
registerImportMdPlugin(md);
},
theme: "dark-plus",
},

themeConfig: {
logo: "/coalesce-icon-color.svg",
outline: {
level: [2,3]
},
// https://vitepress.dev/reference/default-theme-config
nav: [
{ text: "Home", link: "/" },
{ text: "Guide", link: "/introduction", activeMatch: "/.+" },
],

sidebar: [
{
text: "Introduction",
link: "/introduction",
items: [
{ text: "Getting Started", link: "/stacks/vue/getting-started" },
],
},
{
text: "Data Modeling",
items: [
autoTitle("/modeling/model-types/entities"),
autoTitle("/modeling/model-types/external-types"),
autoTitle("/modeling/model-types/dtos"),
autoTitle("/modeling/model-types/services"),
],
},
{
text: "Model Customization",
items: [
// This is deliberately here in a prominent place because its important,
// even though the path is inconsistent with these other pages.
autoTitle("/topics/security"),
autoTitle("/modeling/model-components/properties"),
{
text: "Attributes",
link: "/modeling/model-components/attributes.html",
collapsed: true,
items: fs
.readdirSync(
path.resolve(
__dirname,
"../modeling/model-components/attributes"
)
)
.map((f) =>
autoTitle("/modeling/model-components/attributes/" + f)
),
},
autoTitle("/modeling/model-components/methods"),
autoTitle("/modeling/model-components/data-sources"),
autoTitle("/modeling/model-components/behaviors"),
],
},
{
text: "Frontend - Vue",
link: "/stacks/vue/overview",
// collapsed: false,
items: [
{ text: "Metadata", link: "/stacks/vue/layers/metadata" },
{ text: "Models", link: "/stacks/vue/layers/models" },
{ text: "API Clients", link: "/stacks/vue/layers/api-clients" },
{ text: "View Models", link: "/stacks/vue/layers/viewmodels" },
],
},
{
text: "Vuetify Components",
collapsed: true,
link: "/stacks/vue/coalesce-vue-vuetify/overview",
items: [
...fs
.readdirSync(
path.resolve(
__dirname,
"../stacks/vue/coalesce-vue-vuetify/components"
)
)
.map((f) =>
autoTitle("/stacks/vue/coalesce-vue-vuetify/components/" + f)
),
],
},
{
text: "Topics",
items: [
{ text: "Config: ASP.NET Core", link: "/topics/startup" },
autoTitle("/topics/audit-logging"),
{ text: "Config: Code Gen", link: "/topics/coalesce-json" },
autoTitle("/concepts/include-tree"),
autoTitle("/concepts/includes"),

{ text: "Vue 2 to Vue 3", link: "/stacks/vue/vue2-to-vue3" },
{
text: "Generated Code",
link: "/stacks/agnostic/generation",
collapsed: true,
items: [autoTitle("/stacks/agnostic/dtos")],
},
].sort((a, b) => a.text.localeCompare(b.text)),
},
{
text: "Knockout (legacy)",
collapsed: true,
items: [
autoTitle("/stacks/ko/overview"),
autoTitle("/stacks/ko/getting-started"),
autoTitle("/stacks/ko/client/view-model"),
autoTitle("/stacks/ko/client/list-view-model"),
autoTitle("/stacks/ko/client/external-view-model"),
autoTitle("/stacks/ko/client/methods"),
autoTitle("/stacks/ko/client/model-config"),
autoTitle("/stacks/ko/client/bindings"),
],
},
],

socialLinks: [
{ icon: "github", link: "https://github.com/IntelliTect/Coalesce" },
],

search: {
provider: "algolia",
options: {
appId: "SDGLJOI8GP",
apiKey: "7aac3b70e2be40bd6bb55bc603e7bf46",
indexName: "coalesce",
},
},
},
});
Loading

0 comments on commit 3bb388b

Please sign in to comment.