Skip to content

Commit

Permalink
fix: Ui improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed Feb 7, 2024
1 parent 750a871 commit eadda01
Show file tree
Hide file tree
Showing 27 changed files with 848 additions and 369 deletions.
6 changes: 6 additions & 0 deletions .changeset/poor-gorillas-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"typedoc-plugin-markdown": patch
---

- Remove blockquotes on signature and declarations.
- Minor ui tweaks.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ exports[`GithubWiki should output member docs 1`] = `
### new ClassA()
> **new ClassA**(): [\`ClassA\`](../wiki/module-1.Class.ClassA)
**new ClassA**(): [\`ClassA\`](../wiki/module-1.Class.ClassA)
#### Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export function declarationMemberIdentifier(

const prefix: string[] = [];

const modifiers = reflection.flags.filter(
(flag) => flag !== 'Optional' && !reflection.flags.isRest,
);
//const modifiers = reflection.flags.filter(() => !reflection.flags.isRest);

if (modifiers.length) {
if (reflection.flags.length) {
prefix.push(
modifiers.map((flag) => bold(backTicks(flag.toLowerCase()))).join(' '),
reflection.flags
.map((flag) => bold(backTicks(flag.toLowerCase())))
.join(' '),
);
}

Expand Down Expand Up @@ -60,7 +60,7 @@ export function declarationMemberIdentifier(
}

if (reflection.flags.isOptional) {
name.push('?');
//name.push('?');
}

if (declarationType) {
Expand All @@ -86,5 +86,5 @@ export function declarationMemberIdentifier(
}

const result = md.join('');
return useCodeBlocks ? codeBlock(result) : `> ${result}`;
return useCodeBlocks ? codeBlock(result) : `${result}`;
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ export function signatureMemberIdentifier(
}

const result = md.join('');
return useCodeBlocks ? codeBlock(result) : `> ${result}`;
return useCodeBlocks ? codeBlock(result) : `${result}`;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
ReflectionType,
SignatureReflection,
SomeType,
UnionType,
} from 'typedoc';
import { MarkdownThemeRenderContext } from '../..';
import { backTicks, blockQuoteBlock, codeBlock, heading } from '../markdown';
Expand Down Expand Up @@ -75,13 +74,13 @@ function getReturnType(
}
if (type) {
const returnType = context.partials.someType(type);
if (
type instanceof UnionType ||
(type instanceof ReflectionType &&
context.options.getValue('expandObjects') &&
context.options.getValue('useCodeBlocks'))
) {
return codeBlock(returnType);
if (context.options.getValue('useCodeBlocks')) {
if (
type instanceof ReflectionType &&
context.options.getValue('expandObjects')
) {
return codeBlock(returnType);
}
}
return returnType;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/typedoc-plugin-markdown/test/fixtures/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ const config: Record<string, Fixture> = {
disableSources: true,
expandObjects: true,
expandParameters: true,
useCodeBlocks: true,
},
options: [
{},
{
useCodeBlocks: true,
parametersFormat: 'table',
propertiesFormat: 'table',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ export function functionWithNamedParams(
anotherParam: string,
) {}

/**
* Function with reset parmas
*/
export function functionWithRestParams(param: string, ...restParams: string[]) {
return true;
}

/**
* Function with type parameters
* @typeParam T Comments for T
Expand Down Expand Up @@ -112,6 +119,9 @@ export function functionWithMultipleSignatures(): string {

/**
* Comments for function
*
* @default {}
*
* @returns Return comments
*/
export function functionReturningAnObject() {
Expand All @@ -126,6 +136,18 @@ export function functionReturningAString() {
return 'hello';
}

/**
* Comments for function
* @returns Return comments
*/
export function functionReturningAUnionType():
| string
| boolean
| 'string1'
| 'string2' {
return 'hello';
}

/**
* Comments for function
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface BasicInterface {
/**
* Comments for propReturningSignatureDeclaration
*/
propReturningSignatureDeclaration: () => any;
propReturningSignatureDeclaration?: () => string | boolean | number;

/**
* Comments for propReturningSignatureDeclarations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,25 +329,25 @@ This is a simple example on how to use include.
### SameName
> **SameName**: \`true\`
**SameName**: \`true\`
***
### \\_prop\\_with\\_underscore
> **\`const\`** **\\_prop\\_with\\_underscore**: \`true\` = \`true\`
**\`const\`** **\\_prop\\_with\\_underscore**: \`true\` = \`true\`
***
### prop
> **\`const\`** **prop**: \`true\` = \`true\`
**\`const\`** **prop**: \`true\` = \`true\`
***
### propb
> **\`const\`** **propb**: \`true\` = \`true\`
**\`const\`** **propb**: \`true\` = \`true\`
"
`;
Expand Down Expand Up @@ -496,30 +496,30 @@ This is a simple example on how to use include.
### SameName
> **SameName**: \`true\`
**SameName**: \`true\`
***
<a id="_prop_with_underscore" name="_prop_with_underscore"></a>
### \\_prop\\_with\\_underscore
> **\`const\`** **\\_prop\\_with\\_underscore**: \`true\` = \`true\`
**\`const\`** **\\_prop\\_with\\_underscore**: \`true\` = \`true\`
***
<a id="prop-3" name="prop-3"></a>
### prop
> **\`const\`** **prop**: \`true\` = \`true\`
**\`const\`** **prop**: \`true\` = \`true\`
***
<a id="propb-3" name="propb-3"></a>
### propb
> **\`const\`** **propb**: \`true\` = \`true\`
**\`const\`** **propb**: \`true\` = \`true\`
"
`;
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Some other comments
### someFunction()
> **someFunction**(): \`void\`
**someFunction**(): \`void\`
#### Returns
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ exports[`EntryFiles should get module member for members: (Output File Strategy
### new ModuleClass()
> **new ModuleClass**(): [\`ModuleClass\`](ModuleClass.md)
**new ModuleClass**(): [\`ModuleClass\`](ModuleClass.md)
#### Returns
Expand All @@ -64,7 +64,7 @@ exports[`EntryFiles should get module member for members: (Output File Strategy
### new ModuleClass()
> **new ModuleClass**(): [\`ModuleClass\`](ModuleClass.md)
**new ModuleClass**(): [\`ModuleClass\`](ModuleClass.md)
#### Returns
Expand Down

0 comments on commit eadda01

Please sign in to comment.