How to use @ts-common/commonmark-to-markdown - 10 common examples

To help you get started, we’ve selected a few @ts-common/commonmark-to-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 / azure-rest-api-specs / scripts / latest-profile-generator.ts View on Github external
const latestProfileDir = Path.join(profilesDirectory, `definitions/`);
    const latestProfileLocation = Path.join(latestProfileDir, `${getFormattedDate()}-profile.md`);
    fs.writeFile(latestProfileLocation, latestProfileMarkDown);
    console.log(`Latest profile written at ${latestProfileLocation}`);
    
    // now get all the profile definitions and generate the readme.
    const definitions = fs.recursiveReaddir(latestProfileDir);
    const definitionsRelativePaths = [];
    for await (const file of definitions){
      const f = Path.parse(file);
      definitionsRelativePaths.push(`$(this-folder)/definitions/${f.base}`);
    }

    const profilesReadme = cm.markDownExToString(
      { 
        markDown: cm.createNode(
          "document",
          cm.createNode(
            'heading',
            cm.createText("Azure Profiles")
          ),
          cm.createNode(
            "block_quote",
            cm.createNode(
              "paragraph",
              cm.createText("see https://aka.ms/autorest")
            )
          ),
          cm.createNode(
            "block_quote",
            cm.createNode(
              "paragraph",
github Azure / azure-rest-api-specs / scripts / latest-profile-generator.ts View on Github external
fs.writeFile(latestProfileLocation, latestProfileMarkDown);
    console.log(`Latest profile written at ${latestProfileLocation}`);
    
    // now get all the profile definitions and generate the readme.
    const definitions = fs.recursiveReaddir(latestProfileDir);
    const definitionsRelativePaths = [];
    for await (const file of definitions){
      const f = Path.parse(file);
      definitionsRelativePaths.push(`$(this-folder)/definitions/${f.base}`);
    }

    const profilesReadme = cm.markDownExToString(
      { 
        markDown: cm.createNode(
          "document",
          cm.createNode(
            'heading',
            cm.createText("Azure Profiles")
          ),
          cm.createNode(
            "block_quote",
            cm.createNode(
              "paragraph",
              cm.createText("see https://aka.ms/autorest")
            )
          ),
          cm.createNode(
            "block_quote",
            cm.createNode(
              "paragraph",
              cm.createText("The files under this directory are the profile definitions used by autorest.")
            )
github Azure / azure-rest-api-specs / scripts / latest-profile-generator.ts View on Github external
const latestProfileMarkDown = cm.markDownExToString(
      { 
        markDown: cm.createNode(
        "document",
        cm.createNode(
          "heading",
          cm.createText("Latest Azure Profile")
        ),
        cm.createNode(
          "block_quote",
          cm.createNode(
            "paragraph",
            cm.createText("see https://aka.ms/autorest")
          )
        ),
          cm.createCodeBlock(
            "yaml ",
            yaml.dump({ "profiles":{[`latest-${getFormattedDate()}`]: latestProfile} }, { lineWidth: 1000 })
          )
        )
      }
    );
    const latestProfileDir = Path.join(profilesDirectory, `definitions/`);
    const latestProfileLocation = Path.join(latestProfileDir, `${getFormattedDate()}-profile.md`);
    fs.writeFile(latestProfileLocation, latestProfileMarkDown);
    console.log(`Latest profile written at ${latestProfileLocation}`);
    
    // now get all the profile definitions and generate the readme.
    const definitions = fs.recursiveReaddir(latestProfileDir);
    const definitionsRelativePaths = [];
    for await (const file of definitions){
      const f = Path.parse(file);
github Azure / azure-rest-api-specs / scripts / latest-profile-generator.ts View on Github external
}
    );
    const latestProfileDir = Path.join(profilesDirectory, `definitions/`);
    const latestProfileLocation = Path.join(latestProfileDir, `${getFormattedDate()}-profile.md`);
    fs.writeFile(latestProfileLocation, latestProfileMarkDown);
    console.log(`Latest profile written at ${latestProfileLocation}`);
    
    // now get all the profile definitions and generate the readme.
    const definitions = fs.recursiveReaddir(latestProfileDir);
    const definitionsRelativePaths = [];
    for await (const file of definitions){
      const f = Path.parse(file);
      definitionsRelativePaths.push(`$(this-folder)/definitions/${f.base}`);
    }

    const profilesReadme = cm.markDownExToString(
      { 
        markDown: cm.createNode(
          "document",
          cm.createNode(
            'heading',
            cm.createText("Azure Profiles")
          ),
          cm.createNode(
            "block_quote",
            cm.createNode(
              "paragraph",
              cm.createText("see https://aka.ms/autorest")
            )
          ),
          cm.createNode(
            "block_quote",
github Azure / azure-rest-api-specs / scripts / latest-profile-generator.ts View on Github external
// now get all the profile definitions and generate the readme.
    const definitions = fs.recursiveReaddir(latestProfileDir);
    const definitionsRelativePaths = [];
    for await (const file of definitions){
      const f = Path.parse(file);
      definitionsRelativePaths.push(`$(this-folder)/definitions/${f.base}`);
    }

    const profilesReadme = cm.markDownExToString(
      { 
        markDown: cm.createNode(
          "document",
          cm.createNode(
            'heading',
            cm.createText("Azure Profiles")
          ),
          cm.createNode(
            "block_quote",
            cm.createNode(
              "paragraph",
              cm.createText("see https://aka.ms/autorest")
            )
          ),
          cm.createNode(
            "block_quote",
            cm.createNode(
              "paragraph",
              cm.createText("The files under this directory are the profile definitions used by autorest.")
            )
          ),
          cm.createCodeBlock(
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
  }
}
github Azure / azure-rest-api-specs / scripts / latest-profile-generator.ts View on Github external
}
    
    if (!foundMultiApiReadmes){
      throw  `Couldn't find any readme.enable-multi-api.md files.`
    }

    const allPaths = await getPaths(specs);
    const crawlResult = getCrawlData(allPaths);
    const telemetryDir = Path.join(profilesDirectory, 'crawl-log.json')
    fs.writeFile(telemetryDir, JSON.stringify(crawlResult, null, 2));
    console.log(`Telemetry written at ${telemetryDir}`);
    
    const latestProfile = getLatestProfile(crawlResult);
    const latestProfileMarkDown = cm.markDownExToString(
      { 
        markDown: cm.createNode(
        "document",
        cm.createNode(
          "heading",
          cm.createText("Latest Azure Profile")
        ),
        cm.createNode(
          "block_quote",
          cm.createNode(
            "paragraph",
            cm.createText("see https://aka.ms/autorest")
          )
        ),
          cm.createCodeBlock(
            "yaml ",
            yaml.dump({ "profiles":{[`latest-${getFormattedDate()}`]: latestProfile} }, { lineWidth: 1000 })
          )
github Azure / azure-rest-api-specs / scripts / latest-profile-generator.ts View on Github external
const profilesReadme = cm.markDownExToString(
      { 
        markDown: cm.createNode(
          "document",
          cm.createNode(
            'heading',
            cm.createText("Azure Profiles")
          ),
          cm.createNode(
            "block_quote",
            cm.createNode(
              "paragraph",
              cm.createText("see https://aka.ms/autorest")
            )
          ),
          cm.createNode(
            "block_quote",
            cm.createNode(
              "paragraph",
              cm.createText("The files under this directory are the profile definitions used by autorest.")
            )
          ),
          cm.createCodeBlock(
            "yaml",
            yaml.dump({ "require": definitionsRelativePaths })
          )
        )
      }
    );

    fs.writeFile(Path.join(profilesDirectory, "readme.md"), profilesReadme);
    console.log(`Regenerated profiles readme.md at ${profilesDirectory}`);
github Azure / azure-rest-api-specs / scripts / latest-profile-generator.ts View on Github external
const telemetryDir = Path.join(profilesDirectory, 'crawl-log.json')
    fs.writeFile(telemetryDir, JSON.stringify(crawlResult, null, 2));
    console.log(`Telemetry written at ${telemetryDir}`);
    
    const latestProfile = getLatestProfile(crawlResult);
    const latestProfileMarkDown = cm.markDownExToString(
      { 
        markDown: cm.createNode(
        "document",
        cm.createNode(
          "heading",
          cm.createText("Latest Azure Profile")
        ),
        cm.createNode(
          "block_quote",
          cm.createNode(
            "paragraph",
            cm.createText("see https://aka.ms/autorest")
          )
        ),
          cm.createCodeBlock(
            "yaml ",
            yaml.dump({ "profiles":{[`latest-${getFormattedDate()}`]: latestProfile} }, { lineWidth: 1000 })
          )
        )
      }
    );
    const latestProfileDir = Path.join(profilesDirectory, `definitions/`);
    const latestProfileLocation = Path.join(latestProfileDir, `${getFormattedDate()}-profile.md`);
    fs.writeFile(latestProfileLocation, latestProfileMarkDown);
    console.log(`Latest profile written at ${latestProfileLocation}`);
github Azure / azure-rest-api-specs / scripts / latest-profile-generator.ts View on Github external
}

    const allPaths = await getPaths(specs);
    const crawlResult = getCrawlData(allPaths);
    const telemetryDir = Path.join(profilesDirectory, 'crawl-log.json')
    fs.writeFile(telemetryDir, JSON.stringify(crawlResult, null, 2));
    console.log(`Telemetry written at ${telemetryDir}`);
    
    const latestProfile = getLatestProfile(crawlResult);
    const latestProfileMarkDown = cm.markDownExToString(
      { 
        markDown: cm.createNode(
        "document",
        cm.createNode(
          "heading",
          cm.createText("Latest Azure Profile")
        ),
        cm.createNode(
          "block_quote",
          cm.createNode(
            "paragraph",
            cm.createText("see https://aka.ms/autorest")
          )
        ),
          cm.createCodeBlock(
            "yaml ",
            yaml.dump({ "profiles":{[`latest-${getFormattedDate()}`]: latestProfile} }, { lineWidth: 1000 })
          )
        )
      }
    );
    const latestProfileDir = Path.join(profilesDirectory, `definitions/`);

@ts-common/commonmark-to-markdown

Converts commonmark AST (back) to plain markdown

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis

Similar packages