Skip to content

Commit

Permalink
docs: use @codedoc/cli to generate new docs
Browse files Browse the repository at this point in the history
  • Loading branch information
matmar10 committed Oct 22, 2021
1 parent 8db6625 commit 8f992af
Show file tree
Hide file tree
Showing 82 changed files with 20,055 additions and 7,630 deletions.
15 changes: 15 additions & 0 deletions .codedoc/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { build } from '@codedoc/core';

import { config } from './config';
import { installTheme$ } from './content/theme';
import { content } from './content';


build(config, content, installTheme$, {
resolve: {
modules: ['.codedoc/node_modules']
},
resolveLoader: {
modules: ['.codedoc/node_modules']
}
});
23 changes: 23 additions & 0 deletions .codedoc/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

import { configuration } from '@codedoc/core';

import { theme } from './theme';


export const config = /*#__PURE__*/configuration({
theme, // --> add the theme. modify `./theme.ts` for changing the theme.
dest: {
namespace: '/rest-ez' // --> your github pages namespace. remove if you are using a custom domain.
},
page: {
title: {
base: 'REST-EZ' // --> the base title of your doc pages
}
},
misc: {
github: {
user: 'matmar10', // --> your github username (where your repo is hosted)
repo: 'rest-ez', // --> your github repo name
}
},
});
19 changes: 19 additions & 0 deletions .codedoc/content/footer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { CodedocConfig } from '@codedoc/core';
import { Footer as _Footer, GitterToggle$, Watermark} from '@codedoc/core/components';


export function Footer(config: CodedocConfig, renderer: any) {
let github$;
if (config.misc?.github)
github$ = <a href={`https://github.com/${config.misc.github.user}/${config.misc.github.repo}/`}
target="_blank">GitHub</a>;

let community$;
if (config.misc?.gitter)
community$ = <GitterToggle$ room={config.misc.gitter.room}/>

if (github$ && community$) return <_Footer>{github$}<hr/>{community$}</_Footer>;
else if (github$) return <_Footer>{github$}</_Footer>;
else if (community$) return <_Footer>{community$}</_Footer>;
else return <_Footer><Watermark/></_Footer>;
}
21 changes: 21 additions & 0 deletions .codedoc/content/header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { CodedocConfig } from '@codedoc/core';
import { Header as _Header, GithubButton, Watermark } from '@codedoc/core/components';


export function Header(config: CodedocConfig, renderer: any) {
return (
<_Header>{config.misc?.github ?
<fragment>
<GithubButton action={config.misc.github.action || 'Star'}
repo={config.misc.github.repo}
user={config.misc.github.user}
large={config.misc.github.large === true}
count={config.misc.github.count !== false}
standardIcon={config.misc.github.standardIcon !== false}/>
<br/><br/>
</fragment>
: ''}
<Watermark/>
</_Header>
)
}
38 changes: 38 additions & 0 deletions .codedoc/content/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { RendererLike } from '@connectv/html';
import { File } from 'rxline/fs';
import { Page, Meta, ContentNav, Fonts, ToC, GithubSearch$ } from '@codedoc/core/components';

import { config } from '../config';
import { Header } from './header';
import { Footer } from './footer';


export function content(_content: HTMLElement, toc: HTMLElement, renderer: RendererLike<any, any>, file: File<string>) {
return (
<Page title={config.page.title.extractor(_content, config, file)}
favicon={config.page.favicon}
meta={<Meta {...config.page.meta}/>}
fonts={<Fonts {...config.page.fonts}/>}

scripts={config.page.scripts}
stylesheets={config.page.stylesheets}

header={<Header {...config}/>}
footer={<Footer {...config}/>}
toc={
<ToC search={
config.misc?.github ?
<GithubSearch$
repo={config.misc.github.repo}
user={config.misc.github.user}
root={config.src.base}
pick={config.src.pick.source}
drop={config.src.drop.source}
/> : false
}>{toc}</ToC>
}>
{_content}
<ContentNav content={_content}/>
</Page>
)
}
8 changes: 8 additions & 0 deletions .codedoc/content/theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { funcTransport } from '@connectv/sdh/transport';
import { useTheme } from '@codedoc/core/transport';

import { theme } from '../theme';


export function installTheme() { useTheme(theme); }
export const installTheme$ = /*#__PURE__*/funcTransport(installTheme);
Loading

0 comments on commit 8f992af

Please sign in to comment.