Star

MIT License
Copyright © 2020
CONNECT-platform

linkCode Top Bar

Code snippets can have a top-bar which resembles a generic window manager top-bar and can host file names. This is to enhance the familiarity of code-snippets, increasing their learnability and encouraging readers to try them more actively. Additionally, the filename and extension can help readers quickly identify the language of the snippet and where it would appear in their own project.

By default, any code snippet with more than one line of code will have this bar. You can set the name of the file like this:

1```sql | DB/migrations/some-migration.sql

2create table dbo.PersonData

3 (

4 id int identity(1, 1) ,

5 Name nvarchar(200) not null ,

6 Email nvarchar(200) null ,

7 Phone nvarchar(100) null ,

8 Street nvarchar(200) null ,

9 City nvarchar(200) null ,

10 StateProvince nvarchar(50) null ,

11 PostalCode nvarchar(50) null ,

12 constraint PK_PersonDataID primary key ( id )

13 );

14```

DB/migrations/some-migration.sql
1create table dbo.PersonData

2 (

3 id int identity(1, 1) ,

4 Name nvarchar(200) not null ,

5 Email nvarchar(200) null ,

6 Phone nvarchar(100) null ,

7 Street nvarchar(200) null ,

8 City nvarchar(200) null ,

9 StateProvince nvarchar(50) null ,

10 PostalCode nvarchar(50) null ,

11 constraint PK_PersonDataID primary key ( id )

12 );


linkDisabling the Top Bar

You can disable the top-bar via .codedoc/theme.ts:

.codedoc/theme.ts
1import { createTheme } from '@codedoc/core/transport';

2

3

4export const theme = /*#__PURE__*/createTheme({

5 // ...

6 code: {

7 wmbar: false, // --> disable the top-bar by default

8 },

9});

Note that the top-bar will still appear for any snippet that has a file name.


linkDisabling/Enabling per Snippet

You can also enable/disable the top-bar on a per-snippet basis. Regardless of the theme settings:

1```js | --wmbar

2// --> lets add a comment so this snippet is two lines

3console.log('HALO!');

4```

1// --> lets add a comment so this snippet is two lines

2console.log('HALO!');


1```js | whatever.js | --no-wmbar

2// --> lets add a comment so this snippet is two lines

3console.log('HALO!');

4```

whatever.js
1// --> lets add a comment so this snippet is two lines

2console.log('HALO!');

Code Top BarDisabling the Top BarDisabling/Enabling per Snippet

Home Overview CLI Theme

Markdownchevron_right
Code Featureschevron_right

Images & Assets

Configurationchevron_right
Customizationchevron_right