@compodoc/compodoc
Version:
The missing documentation tool for your Angular application
15 lines (12 loc) • 534 B
text/typescript
import { IHtmlEngineHelper } from './html-engine-helper.interface';
import * as Handlebars from 'handlebars';
export class BreakLinesHelper implements IHtmlEngineHelper {
constructor(private bars) {}
public helperFunc(context: any, text: string) {
text = this.bars.Utils.escapeExpression(text);
text = text.replace(/(\r\n|\n|\r)/gm, '<br>');
text = text.replace(/ /gm, ' ');
text = text.replace(/ /gm, ' ');
return new Handlebars.SafeString(text);
}
}