Generators
file
The file
generator reads a file and inlines it's contents.
Example
Input
<!-- automd:file src="../../test/fixture/src/example.ts" code -->
<!-- /automd -->
Output
<!-- automd:file src="../../test/fixture/src/example.ts" code -->
```ts [example.ts]
/**
* Adds two numbers together.
*
* @example
*
* ```js
* add(1, 2); // 3
* ```
*/
export function add(a: number, b: number) {
return a + b;
}
export const object = {
/**
* An object key
*/
key: {
/**
* A subkey
*/
subkey: "value",
},
};
```
<!-- /automd -->
Arguments
src
string
Relative path to the file.
code
boolean
Render file as code.
lang
string
Code lang.
name
string|boolean
File name in code. Use no-name
to disable name in code.