Star

MIT License
Copyright © 2020
CONNECT-platform

linkConfiguration

CODEDOC's configuration is read from .codedoc/config.ts. A typical config file looks like this:

.codedoc/config.ts
1import { configuration } from '@codedoc/core';

2

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

4

5

6export const config = /*#__PURE__*/configuration({

7 theme,

8 dest: {

9 namespace: '/my-project',

10 },

11 page: {

12 title: {

13 base: 'My Project'

14 },

15 favicon: '/favicon.ico'

16 },

17 misc: {

18 github: {

19 user: 'johndoe',

20 repo: 'my-project',

21 },

22 gitter: {

23 room: 'my-project'

24 }

25 }

26});


linkTheme

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.

Read More on Theme

linkAvailable Properties

The following are all of the configurable properties, set to their default values:

.codedoc/config.ts
1import { configuration,

2 DefaultMarkdownCustomComponents,

3 DefaultMarkdownCustomInlineComponents,

4 DefaultToCMarkdownCustomComponents,

5 DefaultToCMarkdownCustomInlineComponents,

6 } from '@codedoc/core';

7import { guessTitle } from '@codedoc/core/transport';

8

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

10

11export const config = configuration({

12 theme, // --> always include your theme

13 src: { // @see /docs/config/entry

14 base: 'docs/md', // --> the base folder for all markdowns

15 toc: '_toc.md', // --> markdown file for toc, relative to `base`

16 not_found: '404.md' // --> markdown file for 404 page, relative to `base`

17 pick: /\.md$/, // --> which files to pick (default: .md files)

18 drop: /(^_)|(\/_)/, // --> which files to drop (default: _something.md files)

19 },

20

21 dest: { // @see /docs/config/output

22 html: '.', // --> the base folder for HTML files

23 assets: '.', // --> the base folder for assets

24 bundle: 'docs/assets', // --> where to store codedoc's bundle (relative to `assets`)

25 styles: 'docs/assets', // --> where to store codedoc's styles (relative to `assets`)

26 namespace: '', // --> project namespace

27 },

28

29 bundle: { // @see /docs/config/bundle

30 init: [ // --> a list of initialization scripts for codedoc's bundle

31 codeSelection$, // --> this fella makes code snippets interactively selectable

32 sameLineLengthInCodes$, // --> this fella ensures the same line length in code snippets

33 codeLineHints$, // --> this fella is responsible for hints in code snippets

34 codeLineRef$, // --> this fella is responsible for references in code snippets

35 smartCopy$, // --> this fella makes `CopyButton` work

36 copyHeadings$, // --> this fella makes links to headings easily copiable

37 contentNavHighlight$, // --> this fella highlights current section in content nav

38 deferredIframes$, // --> this fella defers iframes for faster loading

39 smoothLoading$, // --> this fella makes loading new pages smoothly like an SPA app

40 tocHighlight$, // --> this fella highlights the current page in ToC

41 postNavSearch$, // --> this fella is repsonsible for searching a term in a page

42 ],

43 },

44

45 afterBuild: [], // @see /docs/config/hooks

46

47 dev: {

48 port: 3000 // --> the port for local dev server

49 },

50

51 page: { // @see /docs/config/page

52 title: { // --> configuration for page title

53 base: 'Codedoc Sample Page', // --> the base term of page title

54 connector: ' | ', // --> the connector of different parts of the page title

55 extractor: (content, config) => // --> the page-specific title extractor

56 guessTitle(

57 content,

58 config.page.title.base,

59 config.page.title.connector

60 ),

61 },

62 favicon: undefined // --> link to your fav icon

63 meta: { // --> meta tags of each page

64 subject: undefined // --> the subject meta tag for each page

65 description: undefined // --> description meta tag for each page

66 keywords: [], // --> a list of SEO keywords

67 themeColor: '#212121', // --> the browser bar color of your docs

68 appleMobileWebStatusBarStyle: // --> same as above, but for iOS Safari

69 'black-translucent'

70 },

71 fonts: { // --> font settings

72 text: { // --> font used for texts

73 url: // --> URL of font used for texts

74 'https://fonts.googleapis.com/css?family=Hind:400,700&display=swap',

75 name: 'Hind' // --> name of font used for texts

76 fallback: 'sans-serif' // --> the fallback font for texts

77 },

78 code: { // --> font used for codes

79 url: // --> URL of font used for codes

80 'https://fonts.googleapis.com/css?family=Source+Code+Pro:300,400&display=swap',

81 name: 'Source Code Pro', // --> name of the font used for codes

82 fallback: // --> fallback font for codes

83 `'Courier New', Courier, monospace`

84 },

85 icon: { // --> the icon font

86 url: // --> url of hte icon font (and perhaps the outline icon font)

87 'https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Outlined',

88 name: 'Material Icons', // --> name of the icon font

89 outline: // --> name of the outline icon font

90 'Material Icons Outlined'

91 }

92 },

93 scripts: [], // --> a list of script elements to be added to the head

94 stylesheets: [], // --> a list of stylesheet elements to be added to the head

95 post: [], // --> a list of functions for post-processing each generated HTML page

96 },

97

98 markdown: { // @see /docs/config/markdown

99 Code,

100 Heading,

101 customComponents: // --> custom components available in markdown

102 DefaultMarkdownCustomComponents, // --> default components provided by codedoc

103 customInlineComponents: // --> custom inline components available in markdown

104 DefaultMarkdownCustomInlineComponents

105 },

106 tocMarkdown: { // @see /docs/config/markdown

107 Heading: ToCHeading,

108 customComponents: // --> custom components available while parsing toc markdown

109 DefaultToCMarkdownCustomComponents,// --> default toc components provided by codedoc

110 customInlineComponents: // --> custom inline components available in toc markdown

111 DefaultToCMarkdownCustomInlineComponents

112 },

113 plugins: [], // @see /docs/config/plugins

114});

ConfigurationThemeAvailable Properties

Home Overview CLI Theme

Markdownchevron_right
Code Featureschevron_right

Images & Assets

Configurationchevron_right
Customizationchevron_right