How to use the nomnoml.renderSvg function in nomnoml

To help you get started, we’ve selected a few nomnoml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github videojs / http-streaming / scripts / create-docs-images.js View on Github external
build() {
    const files = fs.readdirSync(nomnomlSourceDir);

    while (files.length > 0) {
      const file = path.resolve(nomnomlSourceDir, files.shift());
      const basename = path.basename(file, 'txt');

      if (/.nomnoml/.test(basename)) {
        const fileContents = fs.readFileSync(file, 'utf-8');
        const generated = nomnoml.renderSvg(fileContents);
        const newFilePath = path.join(docImageDir, basename) + 'svg';
        const outFile = fs.createWriteStream(newFilePath);

        console.log(`wrote file ${newFilePath}`);
        outFile.write(generated);
      }
    }
  }
};
github yuzutech / kroki / nomnoml / index.js View on Github external
function convert () {
  const source = data.toString(encoding)
  if (source === '') {
    return
  }
  console.log(nomnoml.renderSvg(source))
}
github doctorrustynelson / vscode-nomnoml / src / extension.ts View on Github external
private generateDiagram( text: string ): string {
            let svg : string;
            let backgroundColor : string = undefined;

            try {
                svg = nomnoml.renderSvg( text );
                let result = /\#bgColor\:\s?(\S*)/.exec( text );
                if( result && result[ 1 ] )
                    backgroundColor = result[ 1 ];
            } catch( exception ){
                return this.errorSnippet( exception );
            }
            
            return `
                <div style="width: 100%; height: 100%; overflow: scroll;">
                ${ svg }
                </div> 
github xm-online / xm-webapp / src / app / admin-config / specification-mng / config-visualizer-dialog / config-visualizer-dialog.component.ts View on Github external
public doDownloadSvg(name): void {
        const svg = nomnoml.renderSvg(this.source, this.canvas.nativeElement);
        const blob = new Blob([svg], {type: 'image/svg+xml'});
        const filename = name;
        saveFile(blob, filename, 'image/svg+xml');
    }

nomnoml

The sassy UML renderer that generates diagrams from text

MIT
Latest version published 8 days ago

Package Health Score

73 / 100
Full package analysis