• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript node.argdown类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@argdown/node.argdown的典型用法代码示例。如果您正苦于以下问题:TypeScript argdown类的具体用法?TypeScript argdown怎么用?TypeScript argdown使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了argdown类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: async

export const handler = async (args: Arguments<IGeneralCliOptions>) => {
  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));
};
开发者ID:christianvoigt,项目名称:argdown,代码行数:7,代码来源:DefaultCommand.ts


示例2: function

export const handler = async function(
  args: Arguments<IGeneralCliOptions & IHtmlCliOptions>
) {
  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;
  }
  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", "parse-input"];
  config.logParserErrors = args.logParserErrors || config.logParserErrors;
  if (config.logParserErrors) {
    config.process.push("log-parser-errors");
  }
  config.process.push("build-model");
  config.process.push("colorize");
  config.process.push("export-html");

  if (!args.stdout || args.outputDir) {
    config.process.push("save-as-html");
  }

  if (args.css) {
    config.html.css = args.css;
  } else if (!args.stdout || args.outputDir) {
    config.process.push("copy-default-css");
  }
  if (args.stdout) {
    config.process.push("stdout-html");
  }

  await argdown.load(config).catch((e: Error) => console.log(e.message));
};
开发者ID:christianvoigt,项目名称:argdown,代码行数:51,代码来源:HtmlCommand.ts


示例3: getRangeOfHeading

 public async getRangeOfHeading(
   doc: vscode.TextDocument,
   config: ArgdownPreviewConfiguration,
   headingText: string
 ): Promise<vscode.Range> {
   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);
 }
开发者ID:christianvoigt,项目名称:argdown,代码行数:28,代码来源:ArgdownEngine.ts


示例4: async

export const handler = async (
  args: Arguments<IGeneralCliOptions & IJSONCliOptions>
) => {
  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;
  }
  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", "parse-input"];
  config.logParserErrors = args.logParserErrors || config.logParserErrors;
  if (config.logParserErrors) {
    config.process.push("log-parser-errors");
  }
  config.process.push("build-model");
  config.process.push("colorize");
  config.process.push("export-json");

  if (!args.stdout || args.outputDir) {
    config.process.push("save-as-json");
  }
  if (args.stdout) {
    config.process.push("stdout-json");
  }

  await argdown.load(config).catch(e => console.log(e));
};
开发者ID:christianvoigt,项目名称:argdown,代码行数:45,代码来源:JSONCommand.ts


示例5: async

export const handler = async (
  args: Arguments<IGeneralCliOptions & ICompileCliOptions>
) => {
  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) {
    config.process.push("stdout-argdown");
  }
  await argdown.load(config).catch((e: Error) => console.log(e));
};
开发者ID:christianvoigt,项目名称:argdown,代码行数:24,代码来源:CompileCommand.ts


示例6: loadConfig

 public async loadConfig(
   configFile: string | undefined,
   resource: vscode.Uri
 ): Promise<IArgdownRequest> {
   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);
 }
开发者ID:christianvoigt,项目名称:argdown,代码行数:17,代码来源:ArgdownEngine.ts


示例7: exportHtml

 public async exportHtml(
   doc: vscode.TextDocument,
   config: ArgdownPreviewConfiguration
 ): Promise<string> {
   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!;
 }
开发者ID:christianvoigt,项目名称:argdown,代码行数:19,代码来源:ArgdownEngine.ts


示例8: getRangeOfMapNode

 public async getRangeOfMapNode(
   doc: vscode.TextDocument,
   config: ArgdownPreviewConfiguration,
   id: string
 ): Promise<vscode.Range> {
   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) {
     const eqClass = response.statements![node.title!];
     const statement = IEquivalenceClass.getCanonicalMember(eqClass);
     if (statement) {
       return new vscode.Range(
         (statement.startLine || 1) - 1,
         (statement.startColumn || 1) - 1,
         (statement.endLine || 1) - 1,
         statement.endColumn || 1
       );
     }
   }
   return new vscode.Range(0, 0, 0, 0);
 }
开发者ID:christianvoigt,项目名称:argdown,代码行数:43,代码来源:ArgdownEngine.ts


示例9: getMapNodeId

 public async getMapNodeId(
   doc: vscode.TextDocument,
   config: ArgdownPreviewConfiguration,
   line: number,
   character: number
 ): Promise<string> {
   const argdownConfig = config.argdownConfig;
   const input = doc.getText();
   const request: IArgdownRequest = {
     ...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 "";
 }
开发者ID:christianvoigt,项目名称:argdown,代码行数:42,代码来源:ArgdownEngine.ts


示例10: getMap

 public async getMap(
   doc: vscode.TextDocument,
   config: ArgdownPreviewConfiguration
 ): Promise<IMap> {
   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!;
 }
开发者ID:christianvoigt,项目名称:argdown,代码行数:21,代码来源:ArgdownEngine.ts



注:本文中的@argdown/node.argdown类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript signalr.HubConnection类代码示例发布时间:2022-05-28
下一篇:
TypeScript core.ArgdownApplication类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap