How to use the @azure/openapi-markdown.getCodeBlocksAndHeadings function in @azure/openapi-markdown

To help you get started, we’ve selected a few @azure/openapi-markdown 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 Azure / oav / lib / validators / suppressions.ts View on Github external
export const getSuppressions = async (specPath: string): Promise => {
  // find readme.md
  try {
    const readMe = await amd.findReadMe(path.dirname(specPath))
    if (readMe === undefined) {
      return undefined
    }
    const readMeStr = await vfs.readFile(readMe)
    const cmd = md.parse(readMeStr)
    const suppressionCodeBlock = amd.getCodeBlocksAndHeadings(cmd.markDown).Suppression
    if (suppressionCodeBlock === undefined) {
      return undefined
    }
    const suppression = amd.getYamlFromNode(suppressionCodeBlock) as amd.Suppression
    if (!it.isArray(suppression.directive)) {
      return undefined
    }
    return suppression
  } catch (err) {
    log.warn(`Unable to load and parse suppression file. Error: ${err}`)
    return undefined
  }
}

@azure/openapi-markdown

Azure OpenAPI MarkDown

MIT
Latest version published 3 years ago

Package Health Score

54 / 100
Full package analysis