Markdown Overview Buttons Tabs Footnotes Collapse ToC Navigation Formula Page-Specific Meta Custom Components
CODEDOC's configuration is read from .codedoc/config.ts
. A typical config file looks like this:
1linkimport { configuration } from '@codedoc/core';
2link
3linkimport { theme } from './theme';
4link
5link
6linkexport const config = /*#__PURE__*/configuration({
7link theme,
8link dest: {
9link namespace: '/my-project',
10link },
11link page: {
12link title: {
13link base: 'My Project'
14link },
15link favicon: '/favicon.ico'
16link },
17link misc: {
18link github: {
19link user: 'johndoe',
20link repo: 'my-project',
21link },
22link gitter: {
23link room: 'my-project'
24link }
25link }
26link});
The theme of your project is configured in a different file, .codedoc/theme.ts
. This
is because the theme is also imported by client-side codes (codedoc's bundle) and hence
should not be mixed up with your typical project configuration, which might include
imports and elements that cannot be transported (or should not be transported) to the
bundle.
The following are all of the configurable properties, set to their default values:
1linkimport { configuration,
2link DefaultMarkdownCustomComponents,
3link DefaultMarkdownCustomInlineComponents,
4link DefaultToCMarkdownCustomComponents,
5link DefaultToCMarkdownCustomInlineComponents,
6link } from '@codedoc/core';
7linkimport { guessTitle } from '@codedoc/core/transport';
8link
9linkimport { theme } from './theme';
10link
11linkexport const config = configuration({
12link theme, // --> always include your theme
13link src: { // @see /docs/config/entry
14link base: 'docs/md', // --> the base folder for all markdowns
15link toc: '_toc.md', // --> markdown file for toc, relative to `base`
16link not_found: '404.md' // --> markdown file for 404 page, relative to `base`
17link pick: /\.md$/, // --> which files to pick (default: .md files)
18link drop: /(^_)|(\/_)/, // --> which files to drop (default: _something.md files)
19link },
20link
21link dest: { // @see /docs/config/output
22link html: '.', // --> the base folder for HTML files
23link assets: '.', // --> the base folder for assets
24link bundle: 'docs/assets', // --> where to store codedoc's bundle (relative to `assets`)
25link styles: 'docs/assets', // --> where to store codedoc's styles (relative to `assets`)
26link namespace: '', // --> project namespace
27link },
28link
29link bundle: { // @see /docs/config/bundle
30link init: [ // --> a list of initialization scripts for codedoc's bundle
31link codeSelection$, // --> this fella makes code snippets interactively selectable
32link sameLineLengthInCodes$, // --> this fella ensures the same line length in code snippets
33link codeLineHints$, // --> this fella is responsible for hints in code snippets
34link codeLineRef$, // --> this fella is responsible for references in code snippets
35link smartCopy$, // --> this fella makes `CopyButton` work
36link copyHeadings$, // --> this fella makes links to headings easily copiable
37link contentNavHighlight$, // --> this fella highlights current section in content nav
38link deferredIframes$, // --> this fella defers iframes for faster loading
39link smoothLoading$, // --> this fella makes loading new pages smoothly like an SPA app
40link tocHighlight$, // --> this fella highlights the current page in ToC
41link postNavSearch$, // --> this fella is repsonsible for searching a term in a page
42link ],
43link },
44link
45link afterBuild: [], // @see /docs/config/hooks
46link
47link dev: {
48link port: 3000 // --> the port for local dev server
49link },
50link
51link page: { // @see /docs/config/page
52link title: { // --> configuration for page title
53link base: 'Codedoc Sample Page', // --> the base term of page title
54link connector: ' | ', // --> the connector of different parts of the page title
55link extractor: (content, config) => // --> the page-specific title extractor
56link guessTitle(
57link content,
58link config.page.title.base,
59link config.page.title.connector
60link ),
61link },
62link favicon: undefined // --> link to your fav icon
63link meta: { // --> meta tags of each page
64link subject: undefined // --> the subject meta tag for each page
65link description: undefined // --> description meta tag for each page
66link keywords: [], // --> a list of SEO keywords
67link themeColor: '#212121', // --> the browser bar color of your docs
68link appleMobileWebStatusBarStyle: // --> same as above, but for iOS Safari
69link 'black-translucent'
70link },
71link fonts: { // --> font settings
72link text: { // --> font used for texts
73link url: // --> URL of font used for texts
74link 'https://fonts.googleapis.com/css?family=Hind:400,700&display=swap',
75link name: 'Hind' // --> name of font used for texts
76link fallback: 'sans-serif' // --> the fallback font for texts
77link },
78link code: { // --> font used for codes
79link url: // --> URL of font used for codes
80link 'https://fonts.googleapis.com/css?family=Source+Code+Pro:300,400&display=swap',
81link name: 'Source Code Pro', // --> name of the font used for codes
82link fallback: // --> fallback font for codes
83link `'Courier New', Courier, monospace`
84link },
85link icon: { // --> the icon font
86link url: // --> url of hte icon font (and perhaps the outline icon font)
87link 'https://fonts.googleapis.com/icon?family=Material+Icons%7CMaterial+Icons+Outlined',
88link name: 'Material Icons', // --> name of the icon font
89link outline: // --> name of the outline icon font
90link 'Material Icons Outlined'
91link }
92link },
93link scripts: [], // --> a list of script elements to be added to the head
94link stylesheets: [], // --> a list of stylesheet elements to be added to the head
95link post: [], // --> a list of functions for post-processing each generated HTML page
96link },
97link
98link markdown: { // @see /docs/config/markdown
99link Code,
100link Heading,
101link customComponents: // --> custom components available in markdown
102link DefaultMarkdownCustomComponents, // --> default components provided by codedoc
103link customInlineComponents: // --> custom inline components available in markdown
104link DefaultMarkdownCustomInlineComponents
105link },
106link tocMarkdown: { // @see /docs/config/markdown
107link Heading: ToCHeading,
108link customComponents: // --> custom components available while parsing toc markdown
109link DefaultToCMarkdownCustomComponents,// --> default toc components provided by codedoc
110link customInlineComponents: // --> custom inline components available in toc markdown
111link DefaultToCMarkdownCustomInlineComponents
112link },
113link plugins: [], // @see /docs/config/plugins
114link});