Appearance
Code Highlighting
javascript
const a = 3
typescript
const a: number = 3
markdown
## TEST
html
<ae-design name="test">
</ae-design>
typescript
/* global URL, process */
import path from 'path'
/* eslint-disable-next-line */
export function dirname(importMeta: any): string {
/* c8 ignore next 3 */
const d = path.dirname(decodeURI(new URL(importMeta.url).pathname))
return path.resolve((process.platform == "win32") ? d.substr(1) : d) // eslint-disable-line 2580
}
markdown
highlight line 3 of the imported code, i.e. line 5 of the '../foo.js' file
disable line numbers
@[code{3-10} js{3}:no-line-numbers](../foo.js)
Notice that path aliases are not available in import code syntax. You can use following config to handle path alias yourself:
module.exports = {
markdown: {
importCode: {
handleImportPath: (str) =>
str.replace(/^@src/, path.resolve(__dirname, 'path/to/src')),
},
},
}
<!-- it will be resolved to 'path/to/src/foo.js' -->
@[code](@src/foo.js)
::: tip This import code extension is supported by our built-in plugin.