Skip to content

Commit

Permalink
feat: add setting item to change the height of toc item
Browse files Browse the repository at this point in the history
  • Loading branch information
cqroot committed Nov 3, 2022
1 parent af92b62 commit ea771af
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/panelHtml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default async function panelHtml(headers: any[]) {
const headerIndent = await settingValue('headerIndent');
const headerDepth = await settingValue('headerDepth');
const hoverStyleType = await settingValue('hoverStyleType');
const itemPadding = await settingValue('itemPadding');
const showNumber = await settingValue('showNumber');
const userStyleFile = await settingValue('userStyleFile');
const userStyle = await settingValue('userStyle');
Expand Down Expand Up @@ -120,7 +121,7 @@ export default async function panelHtml(headers: any[]) {
.toc-item {
display: block;
margin: 0;
padding: 2px 0;
padding: ${itemPadding}px 0;
color: ${fontColor};
${linewrapStyle}
text-decoration: none;
Expand Down
25 changes: 17 additions & 8 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ export async function registerSettings(): Promise<void> {
label: 'isVisible',
},

disableLinewrap: {
type: SettingItemType.Bool,
value: false,
description: 'Disable the linewrap',
section: 'outline.settings',
public: true,
label: 'Disable Linewrap',
},
showNumber: {
type: SettingItemType.Bool,
value: false,
Expand Down Expand Up @@ -70,6 +62,14 @@ export async function registerSettings(): Promise<void> {
public: true,
label: 'Header Depth',
},
itemPadding: {
type: SettingItemType.Int,
section: 'outline.settings',
public: true,
label: 'Item Padding',
description: 'This setting is used to change the height of toc item. The unit is px',
value: 2,
},

userStyleFile: {
type: SettingItemType.String,
Expand All @@ -81,6 +81,15 @@ export async function registerSettings(): Promise<void> {
advanced: true,
subType: SettingItemSubType.FilePath,
},
disableLinewrap: {
type: SettingItemType.Bool,
value: false,
description: 'Disable the linewrap',
section: 'outline.settings',
public: true,
advanced: true,
label: 'Disable Linewrap',
},
headerIndent: {
type: SettingItemType.Int,
value: 15,
Expand Down

0 comments on commit ea771af

Please sign in to comment.