How to use the @argdown/node.argdown.loadConfig function in @argdown/node

To help you get started, we’ve selected a few @argdown/node 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 christianvoigt / argdown / packages / argdown-cli / src / commands / DefaultCommand.ts View on Github external
export const handler = async (args: Arguments) => {
  let config = await argdown.loadConfig(args.config);
  config.logLevel = args.verbose ? "verbose" : config.logLevel;
  config.watch = args.watch || config.watch;
  config.logParserErrors = args.logParserErrors || config.logParserErrors;
  await argdown.load(config).catch(e => console.log(e));
};
github christianvoigt / argdown / packages / argdown-cli / src / commands / RunCommand.ts View on Github external
export const handler = async (
  args: Arguments
) => {
  const processName = args.process || "default";
  let config = await argdown.loadConfig(args.config);
  config.process = processName;
  config.logLevel = args.verbose ? "verbose" : config.logLevel;
  config.watch = args.watch || config.watch;
  config.logParserErrors = args.logParserErrors || config.logParserErrors;
  await argdown.load(config).catch(e => console.log(e));
};
github christianvoigt / argdown / packages / argdown-cli / src / commands / JSONCommand.ts View on Github external
export const handler = async (
  args: Arguments
) => {
  let config = await argdown.loadConfig(args.config);

  config.json = config.json || {};

  if (args.spaces !== null) {
    config.json.spaces = args.spaces;
  }
  if (args.removeEmbeddedRelations) {
    config.json.removeEmbeddedRelations = true;
  }
  if (args.removeMap) {
    config.json.exportMap = false;
  }

  if (args.inputGlob) {
    config.inputPath = args.inputGlob;
  }
github christianvoigt / argdown / packages / argdown-vscode / src / preview / ArgdownEngine.ts View on Github external
public async loadConfig(
    configFile: string | undefined,
    resource: vscode.Uri
  ): Promise {
    if (!configFile) {
      return {};
    }
    const workspaceFolder = vscode.workspace.getWorkspaceFolder(resource);
    let configPath = configFile;
    if (workspaceFolder) {
      let rootPath = workspaceFolder.uri.fsPath;
      configPath = path.resolve(rootPath, configFile);
    } else if (!path.isAbsolute(configPath)) {
      return {};
    }
    return await argdown.loadConfig(configPath);
  }
}
github christianvoigt / argdown / packages / argdown-cli / src / commands / MapCommand.ts View on Github external
export const handler = async (
  args: Arguments
) => {
  let config = await argdown.loadConfig(args.config);

  config.dot = config.dot || {};
  config.map = config.map || {};
  config.group = config.group || {};
  config.selection = config.selection || {};
  config.color = config.color || {};
  const format = args.format || "pdf";
  if (format === "pdf") {
    config.svgToPdf = config.svgToPdf || {};
  } else {
    config.saveAs = config.saveAs || {};
  }

  if (args.useHtmlLabels) {
    config.dot.useHtmlLabels = true;
  }
github christianvoigt / argdown / packages / argdown-cli / src / commands / CompileCommand.ts View on Github external
export const handler = async (
  args: Arguments
) => {
  let config = await argdown.loadConfig(args.config);

  if (args.inputGlob) {
    config.inputPath = args.inputGlob;
  }
  config.saveAs = config.saveAs || {};
  if (args.outputDir) {
    config.saveAs.outputDir = args.outputDir;
  }

  config.logLevel = args.verbose ? "verbose" : config.logLevel;
  config.watch = args.watch || config.watch;
  config.process = ["load-file"];
  if (!args.stdout || args.outputDir) {
    config.process.push("save-as-argdown");
  }
  if (args.stdout) {
github christianvoigt / argdown / packages / argdown-cli / src / commands / HtmlCommand.ts View on Github external
export const handler = async function(
  args: Arguments
) {
  let config = await argdown.loadConfig(args.config);

  config.html = config.html || {};

  if (args.headless) {
    config.html.headless = true;
  }
  if (args.title) {
    config.title = args.title;
  }
  if (args.lang) {
    config.html.lang = args.lang;
  }

  if (args.inputGlob) {
    config.inputPath = args.inputGlob;
  }

@argdown/node

Async Argdown application for node.js

MIT
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis