CODE
')
41 | })
42 |
43 | test('.highlight', () => {
44 | const html = new HTML
45 | expect(html.highlight('CODE')).toBe('CODE')
46 | })
47 |
48 | test('.sup', () => {
49 | const html = new HTML
50 | expect(html.sup('CODE')).toBe(' CODE')
51 | })
52 |
53 | test('.line', () => {
54 | const html = new HTML
55 | expect(html.index).toBe(1)
56 | expect(html.line('CODE')).toBe('${code}
`;
9 | }
10 |
11 | highlight(text: string): string {
12 | return `${text}`;
13 | }
14 |
15 | sup(text: string): string {
16 | return ` ${text}`;
17 | }
18 |
19 | line(code?: string): string {
20 | const row = this.index++;
21 | return `Package description
\n") 72 | expect(typeDescription).toHaveProperty('description', "Type description
\n") 73 | }) 74 | }) -------------------------------------------------------------------------------- /lib/utility/template.ts: -------------------------------------------------------------------------------- 1 | import marked from "marked"; 2 | import slug from "slug"; 3 | import { 4 | DocumentSectionInterface, 5 | NavigationSectionInterface, 6 | PluginInterface, 7 | TypeRef 8 | } from "../interface"; 9 | import { Plugin } from "./plugin"; 10 | 11 | export function slugTemplate() { 12 | return (text, render) => slug(render(text)).toLowerCase(); 13 | } 14 | 15 | export interface ITemplateData { 16 | title: string; 17 | type?: TypeRef; 18 | description: string; 19 | headers: string; 20 | navigations: NavigationSectionInterface[]; 21 | documents: DocumentSectionInterface[]; 22 | projectPackage: any; 23 | graphdocPackage: any; 24 | slug: typeof slugTemplate; 25 | } 26 | 27 | type Headers = string[]; 28 | type Navs = NavigationSectionInterface[]; 29 | type Docs = DocumentSectionInterface[]; 30 | 31 | export async function createData( 32 | projectPackage: any, 33 | graphdocPackage: any, 34 | plugins: PluginInterface[], 35 | type?: TypeRef 36 | ): Promise{{type.kind}}
{{/type}} 34 |