How to use the @argdown/node.argdown.runAsync 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-vscode / src / preview / ArgdownEngine.ts View on Github external
...argdownConfig,
      input: input,
      findElementAtPosition: {
        line: line + 1,
        character: character + 1
      },
      process: [
        "parse-input",
        "build-model",
        "build-map",
        "colorize",
        "find-element-at-position"
      ],
      throwExceptions: true
    };
    const response = await argdown.runAsync(request);
    if (response.elementAtPosition) {
      const title = response.elementAtPosition.title;
      let nodeType = ArgdownTypes.ARGUMENT_MAP_NODE;
      if (response.elementAtPosition.type === ArgdownTypes.EQUIVALENCE_CLASS) {
        nodeType = ArgdownTypes.STATEMENT_MAP_NODE;
      }
      const node = this.findNodeInMapNodeTree(
        response.map!.nodes,
        n => n.title === title && n.type === nodeType
      );
      if (!node) {
        return "";
      }
      return node.id || "";
    }
    return "";
github christianvoigt / argdown / packages / argdown-vscode / src / preview / ArgdownEngine.ts View on Github external
): Promise {
    const argdownConfig = config.argdownConfig;
    const input = doc.getText();
    const request = {
      ...argdownConfig,
      input: input,
      process: [
        "parse-input",
        "build-model",
        "build-map",
        "transform-closed-groups",
        "colorize"
      ],
      throwExceptions: true
    };
    const response = await argdown.runAsync(request);
    return response.map!;
  }
  public async exportMapJson(
github christianvoigt / argdown / packages / argdown-vscode / src / preview / ArgdownEngine.ts View on Github external
): Promise {
    const argdownConfig = config.argdownConfig || {};
    const input = doc.getText();
    const request: IArgdownRequest = {
      ...argdownConfig,
      input: input,
      process: [
        "parse-input",
        "build-model",
        "build-map",
        "colorize",
        "export-graphml"
      ],
      throwExceptions: true
    };
    const response = await argdown.runAsync(request);
    return response.graphml!;
  }
  public async loadConfig(
github christianvoigt / argdown / packages / argdown-vscode / src / preview / ArgdownEngine.ts View on Github external
public async getRangeOfMapNode(
    doc: vscode.TextDocument,
    config: ArgdownPreviewConfiguration,
    id: string
  ): Promise {
    const argdownConfig = config.argdownConfig;
    const input = doc.getText();
    const request: IArgdownRequest = {
      ...argdownConfig,
      input: input,
      process: ["parse-input", "build-model", "build-map", "colorize"],
      throwExceptions: true
    };
    const response = await argdown.runAsync(request);
    const node = this.findNodeInMapNodeTree(
      response.map!.nodes,
      (n: any) => n.id === id
    );
    if (node && node.type === ArgdownTypes.ARGUMENT_MAP_NODE) {
      const argument = response.arguments![node.title!];
      const desc = IArgument.getCanonicalMember(argument);
      if (desc) {
        return new vscode.Range(
          (desc.startLine || 1) - 1,
          (desc.startColumn || 1) - 1,
          (desc.endLine || 1) - 1,
          desc.endColumn || 1
        );
      }
    } else if (node && node.type === ArgdownTypes.STATEMENT_MAP_NODE) {
github christianvoigt / argdown / packages / argdown-vscode / src / preview / ArgdownEngine.ts View on Github external
const argdownConfig = config.argdownConfig || {};
    const input = doc.getText();
    const request: IArgdownRequest = {
      ...argdownConfig,
      input: input,
      process: [
        "parse-input",
        "build-model",
        "build-map",
        "transform-closed-groups",
        "colorize",
        "export-dot"
      ],
      throwExceptions: true
    };
    const response = await argdown.runAsync(request);
    return response.dot!;
  }
  public async exportGraphML(
github christianvoigt / argdown / packages / argdown-vscode / src / preview / ArgdownEngine.ts View on Github external
const argdownConfig = config.argdownConfig;
    const input = doc.getText();
    const request = {
      ...argdownConfig,
      input: input,
      process: [
        "parse-input",
        "build-model",
        "build-map",
        "transform-closed-groups",
        "colorize",
        "export-json"
      ],
      throwExceptions: true
    };
    const response = await argdown.runAsync(request);
    return response.json!;
  }
  public async exportDot(
github christianvoigt / argdown / packages / argdown-vscode / src / preview / ArgdownEngine.ts View on Github external
public async getRangeOfHeading(
    doc: vscode.TextDocument,
    config: ArgdownPreviewConfiguration,
    headingText: string
  ): Promise {
    const argdownConfig = config.argdownConfig;
    const input = doc.getText();
    const request: IArgdownRequest = {
      ...argdownConfig,
      input: input,
      process: ["parse-input", "build-model"],
      throwExceptions: true
    };
    const response = await argdown.runAsync(request);
    if (!response.sections || response.sections.length == 0) {
      return new vscode.Range(0, 0, 0, 0);
    }
    const section = this.findSection(response.sections, headingText);
    if (section) {
      return new vscode.Range(
        (section.startLine || 1) - 1,
        (section.startColumn || 1) - 1,
        (section.startLine || 1) - 1,
        (section.startColumn || 1) - 1
      );
    }
    return new vscode.Range(0, 0, 0, 0);
  }
  private findSection(
github christianvoigt / argdown / packages / argdown-vscode / src / preview / ArgdownEngine.ts View on Github external
doc: vscode.TextDocument,
    config: ArgdownPreviewConfiguration
  ): Promise {
    const argdownConfig = config.argdownConfig || {};
    const input = doc.getText();
    const request: IArgdownRequest = {
      ...argdownConfig,
      input: input,
      process: ["parse-input", "build-model", "export-html"],
      html: {
        ...argdownConfig.html,
        headless: true
      },
      throwExceptions: true
    };
    const response = await argdown.runAsync(request);
    return response.html!;
  }
  public async getMapNodeId(

@argdown/node

Async Argdown application for node.js

MIT
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis