Skip to content

Commit

Permalink
fix(core): emphasised header items
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed May 3, 2024
1 parent 346c7ca commit a1250dc
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 64 deletions.
2 changes: 0 additions & 2 deletions devtools/packages/fixtures/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ export function writeHtml(key: string, entryPoints: string[]) {
'Warn',
'-out',
fullPath,
'--readme',
'none',
],
...toEntryPoints(entryPoints),
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { link } from '@plugin/libs/markdown';
import { bold, link } from '@plugin/libs/markdown';
import { MarkdownThemeContext } from '@plugin/theme';
import * as path from 'path';
import {
Expand Down Expand Up @@ -42,9 +42,9 @@ export function header(this: MarkdownThemeContext): string {
const indexLabel = this.getText('header.docs');

if (this.page.url === entryFileName) {
md.push(title);
md.push(bold(title));
} else {
md.push(link(title, this.getRelativeUrl(entryFileName)));
md.push(link(bold(title), this.getRelativeUrl(entryFileName)));
}

const preserveReadme =
Expand All @@ -69,13 +69,13 @@ export function header(this: MarkdownThemeContext): string {

if (indexLabel) {
if (this.page.url === readMeUrl) {
md.push(link(indexLabel, this.getRelativeUrl(indexUrl || '')));
md.push(link(bold(indexLabel), this.getRelativeUrl(indexUrl || '')));
} else {
md.push(indexLabel);
md.push(bold(indexLabel));
}
}
} else {
md.push(indexLabel);
md.push(bold(indexLabel));
}

return `${md.join(' • ')}\n\n***\n`;
Expand All @@ -101,12 +101,16 @@ export function header(this: MarkdownThemeContext): string {
? `${packageItem.name} v${packageItem.packageVersion}`
: packageItem.name;

const packagesMeta = this.getPackageMetaData(packageItem.name);
const entryModule = packagesMeta.options?.getValue('entryModule');
const packageEntryFile = `${packageItem.name}/${entryFileName}`;

if (this.page.url === packageEntryFile) {
md.push(packageItemName);
if (this.page.url === packageEntryFile || Boolean(entryModule)) {
md.push(bold(packageItemName));
} else {
md.push(link(packageItemName, this.getRelativeUrl(packageEntryFile)));
md.push(
link(bold(packageItemName), this.getRelativeUrl(packageEntryFile)),
);
}

const preservePackageReadme =
Expand All @@ -115,13 +119,15 @@ export function header(this: MarkdownThemeContext): string {
if (preservePackageReadme) {
if (indexLabel) {
if (this.page.url === packageEntryFile) {
md.push(link(indexLabel, this.getRelativeUrl(packageItem.url || '')));
md.push(
link(bold(indexLabel), this.getRelativeUrl(packageItem.url || '')),
);
} else {
md.push(indexLabel);
md.push(bold(indexLabel));
}
}
} else {
md.push(indexLabel);
md.push(bold(indexLabel));
}

return `${md.join(' • ')}\n\n***\n`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`EntryFiles should get entry module: (Output File Strategy "members") (Option Group "1") 1`] = `
"@scope/entryfile • Docs
"**@scope/entryfile****Docs**
***
Expand All @@ -16,7 +16,7 @@ exports[`EntryFiles should get entry module: (Output File Strategy "members") (O
`;

exports[`EntryFiles should get entry module: (Output File Strategy "members") (Option Group "2") 1`] = `
"@scope/entryfile • Docs
"**@scope/entryfile****Docs**
***
Expand All @@ -31,7 +31,7 @@ exports[`EntryFiles should get entry module: (Output File Strategy "members") (O
`;

exports[`EntryFiles should get module member for members: (Output File Strategy "members") (Option Group "1") 1`] = `
"[@scope/entryfile](../../README.mdx) • Docs
"[**@scope/entryfile**](../../README.mdx) • **Docs**
***
Expand All @@ -52,7 +52,7 @@ exports[`EntryFiles should get module member for members: (Output File Strategy
`;

exports[`EntryFiles should get module member for members: (Output File Strategy "members") (Option Group "2") 1`] = `
"[@scope/entryfile](../../index.mdx) • Docs
"[**@scope/entryfile**](../../index.mdx) • **Docs**
***
Expand All @@ -73,7 +73,7 @@ exports[`EntryFiles should get module member for members: (Output File Strategy
`;

exports[`EntryFiles should get readme file: (Output File Strategy "members") (Option Group "1") 1`] = `
"[@scope/entryfile](README.mdx) • [Docs](README.mdx)
"[**@scope/entryfile**](README.mdx) • [**Docs**](README.mdx)
***
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Groups should compile basic module index page: (Output File Strategy "members") (Option Group "1") 1`] = `
"[typedoc-stubs](../index.md) • Docs
"[**typedoc-stubs**](../index.md) • **Docs**
***
Expand Down Expand Up @@ -36,7 +36,7 @@ A basic module
`;

exports[`Groups should compile basic module index page: (Output File Strategy "members") (Option Group "2") 1`] = `
"[typedoc-stubs](../index.md) • Docs
"[**typedoc-stubs**](../index.md) • **Docs**
***
Expand Down Expand Up @@ -74,7 +74,7 @@ A basic module
`;

exports[`Groups should compile basic module index page: (Output File Strategy "modules") (Option Group "1") 1`] = `
"[typedoc-stubs](index.md) • Docs
"[**typedoc-stubs**](index.md) • **Docs**
***
Expand Down Expand Up @@ -153,7 +153,7 @@ A basic module
`;

exports[`Groups should compile basic module index page: (Output File Strategy "modules") (Option Group "2") 1`] = `
"[typedoc-stubs](index.md) • Docs
"[**typedoc-stubs**](index.md) • **Docs**
***
Expand Down Expand Up @@ -254,7 +254,7 @@ A basic module
`;

exports[`Groups should compile categories group page: (Output File Strategy "modules") (Option Group "1") 1`] = `
"[typedoc-stubs](index.md) • Docs
"[**typedoc-stubs**](index.md) • **Docs**
***
Expand Down Expand Up @@ -311,7 +311,7 @@ A module that contains categories
`;

exports[`Groups should compile categories group page: (Output File Strategy "modules") (Option Group "2") 1`] = `
"[typedoc-stubs](index.md) • Docs
"[**typedoc-stubs**](index.md) • **Docs**
***
Expand Down Expand Up @@ -384,7 +384,7 @@ A module that contains categories
`;

exports[`Groups should compile categories index page: (Output File Strategy "members") (Option Group "1") 1`] = `
"[typedoc-stubs](../index.md) • Docs
"[**typedoc-stubs**](../index.md) • **Docs**
***
Expand Down Expand Up @@ -431,7 +431,7 @@ A module that contains categories
`;

exports[`Groups should compile categories index page: (Output File Strategy "members") (Option Group "2") 1`] = `
"[typedoc-stubs](../index.md) • Docs
"[**typedoc-stubs**](../index.md) • **Docs**
***
Expand Down Expand Up @@ -471,7 +471,7 @@ A module that contains categories
`;

exports[`Groups should compile custom groups index page: (Output File Strategy "members") (Option Group "1") 1`] = `
"[typedoc-stubs](../index.md) • Docs
"[**typedoc-stubs**](../index.md) • **Docs**
***
Expand Down Expand Up @@ -499,7 +499,7 @@ A module that contains custom groupings
`;

exports[`Groups should compile custom groups index page: (Output File Strategy "members") (Option Group "2") 1`] = `
"[typedoc-stubs](../index.md) • Docs
"[**typedoc-stubs**](../index.md) • **Docs**
***
Expand Down Expand Up @@ -544,7 +544,7 @@ Default grouping
`;

exports[`Groups should compile index page for project: (Output File Strategy "members") (Option Group "1") 1`] = `
"[typedoc-stubs](index.md) • Docs
"[**typedoc-stubs**](index.md) • **Docs**
***
Expand All @@ -565,7 +565,7 @@ exports[`Groups should compile index page for project: (Output File Strategy "me
`;

exports[`Groups should compile index page for project: (Output File Strategy "members") (Option Group "2") 1`] = `
"typedoc-stubs • Docs
"**typedoc-stubs****Docs**
***
Expand All @@ -586,7 +586,7 @@ exports[`Groups should compile index page for project: (Output File Strategy "me
`;

exports[`Groups should compile index page for project: (Output File Strategy "modules") (Option Group "1") 1`] = `
"[typedoc-stubs](index.md) • Docs
"[**typedoc-stubs**](index.md) • **Docs**
***
Expand All @@ -607,7 +607,7 @@ exports[`Groups should compile index page for project: (Output File Strategy "mo
`;

exports[`Groups should compile index page for project: (Output File Strategy "modules") (Option Group "2") 1`] = `
"typedoc-stubs • Docs
"**typedoc-stubs****Docs**
***
Expand All @@ -628,7 +628,7 @@ exports[`Groups should compile index page for project: (Output File Strategy "mo
`;

exports[`Groups should compile module index for a namespace: (Output File Strategy "members") (Option Group "1") 1`] = `
"[typedoc-stubs](../../../index.md) • Docs
"[**typedoc-stubs**](../../../index.md) • **Docs**
***
Expand All @@ -649,7 +649,7 @@ exports[`Groups should compile module index for a namespace: (Output File Strate
`;

exports[`Groups should compile module index for a namespace: (Output File Strategy "members") (Option Group "2") 1`] = `
"[typedoc-stubs](../../../index.md) • Docs
"[**typedoc-stubs**](../../../index.md) • **Docs**
***
Expand All @@ -667,7 +667,7 @@ exports[`Groups should compile module index for a namespace: (Output File Strate
`;

exports[`Groups should compile module index for a namespace: (Output File Strategy "modules") (Option Group "1") 1`] = `
"[typedoc-stubs](../../../index.md) • Docs
"[**typedoc-stubs**](../../../index.md) • **Docs**
***
Expand All @@ -688,7 +688,7 @@ exports[`Groups should compile module index for a namespace: (Output File Strate
`;

exports[`Groups should compile module index for a namespace: (Output File Strategy "modules") (Option Group "2") 1`] = `
"[typedoc-stubs](../../../index.md) • Docs
"[**typedoc-stubs**](../../../index.md) • **Docs**
***
Expand All @@ -709,7 +709,7 @@ exports[`Groups should compile module index for a namespace: (Output File Strate
`;

exports[`Groups should compile module index with namespaces index page: (Output File Strategy "members") (Option Group "1") 1`] = `
"[typedoc-stubs](../index.md) • Docs
"[**typedoc-stubs**](../index.md) • **Docs**
***
Expand Down Expand Up @@ -759,7 +759,7 @@ A module that contains namespaces
`;

exports[`Groups should compile module index with namespaces index page: (Output File Strategy "members") (Option Group "2") 1`] = `
"[typedoc-stubs](../index.md) • Docs
"[**typedoc-stubs**](../index.md) • **Docs**
***
Expand Down Expand Up @@ -839,7 +839,7 @@ A module that contains namespaces
`;

exports[`Groups should compile module index with namespaces index page: (Output File Strategy "modules") (Option Group "1") 1`] = `
"[typedoc-stubs](../index.md) • Docs
"[**typedoc-stubs**](../index.md) • **Docs**
***
Expand Down Expand Up @@ -947,7 +947,7 @@ A module that contains namespaces
`;

exports[`Groups should compile module index with namespaces index page: (Output File Strategy "modules") (Option Group "2") 1`] = `
"[typedoc-stubs](../index.md) • Docs
"[**typedoc-stubs**](../index.md) • **Docs**
***
Expand Down Expand Up @@ -1081,7 +1081,7 @@ A module that contains namespaces
`;

exports[`Groups should compile readme for a project: (Output File Strategy "modules") (Option Group "1") 1`] = `
"typedoc-stubs • [Docs](modules.md)
"**typedoc-stubs** • [**Docs**](modules.md)
***
Expand All @@ -1098,7 +1098,7 @@ Some text.
`;

exports[`Groups should compile references group page: (Output File Strategy "modules") (Option Group "1") 1`] = `
"[typedoc-stubs](index.md) • Docs
"[**typedoc-stubs**](index.md) • **Docs**
***
Expand Down Expand Up @@ -1135,7 +1135,7 @@ Renames and re-exports [defaultFunction](has-references.md#defaultfunction)
`;

exports[`Groups should compile references group page: (Output File Strategy "modules") (Option Group "2") 1`] = `
"[typedoc-stubs](index.md) • Docs
"[**typedoc-stubs**](index.md) • **Docs**
***
Expand Down Expand Up @@ -1176,7 +1176,7 @@ Renames and re-exports [defaultFunction](has-references.md#defaultfunction)
`;

exports[`Groups should compile references index page: (Output File Strategy "members") (Option Group "1") 1`] = `
"[typedoc-stubs](../index.md) • Docs
"[**typedoc-stubs**](../index.md) • **Docs**
***
Expand Down Expand Up @@ -1213,7 +1213,7 @@ Renames and re-exports [defaultFunction](functions/defaultFunction.md)
`;

exports[`Groups should compile references index page: (Output File Strategy "members") (Option Group "2") 1`] = `
"[typedoc-stubs](../index.md) • Docs
"[**typedoc-stubs**](../index.md) • **Docs**
***
Expand Down

0 comments on commit a1250dc

Please sign in to comment.