This translator extracts JSDoc comments from any file format and splits the
file along the comments. It treats the text between /**
and
*/
as markdown. Other comments it leaves alone.
import * as bt from './base-translator'
export class JsDocTranslator extends bt.Translator {
protected createBlocks() {
let cssFile = this.outputFile.source as bt.OtherFile
this.splitFile(cssFile.contents, cssFile.fileName)
}
private splitFile(text: string, fileName: string) {
this.scan(text, /\/\*\*(.*?)\*\//gs,
match => this.openMarkdownBlock(match[1]),
code => this.openCodeBlock(code))
}
}