How to use the @ts-common/commonmark-to-markdown.createText function in @ts-common/commonmark-to-markdown

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
// 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 / 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/`);
github Azure / azure-rest-api-specs / scripts / latest-profile-generator.ts View on Github external
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}`);
    console.log('DONE');    
  } catch (e) {
    console.error(e);
  }
github Azure / azure-rest-api-specs / scripts / latest-profile-generator.ts View on Github external
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(
            "yaml",
            yaml.dump({ "require": definitionsRelativePaths })
          )
        )
      }
    );
github Azure / azure-rest-api-specs / scripts / multiapi.ts View on Github external
set.add(i)
              }
            }
          }
        }
        const readMeMulti = cm.createNode(
          "document",
          cm.createNode(
            "heading",
            cm.createText("Multi-API support for AutoRest v3 generators")
          ),
          cm.createNode(
            "block_quote",
            cm.createNode(
              "paragraph",
              cm.createText("see https://aka.ms/autorest")
            )
          ),
          cm.createCodeBlock(
            "yaml $(enable-multi-api)",
            yaml.dump({ "input-file": it.toArray(set) }, { lineWidth: 1000 })
          )
        )
        const x = cm.markDownExToString({ markDown: readMeMulti })
        fs.writeFile(path.join(f.dir, "readme.enable-multi-api.md"), x)
      }
    }
  } catch (e) {
    console.error(e)
  }
}
github Azure / azure-rest-api-specs / scripts / multiapi.ts View on Github external
) {
            const y = (yaml.load(c.literal) as Code)["input-file"]
            if (typeof y === "string") {
              set.add(y)
            } else if (it.isArray(y)) {
              for (const i of y) {
                set.add(i)
              }
            }
          }
        }
        const readMeMulti = cm.createNode(
          "document",
          cm.createNode(
            "heading",
            cm.createText("Multi-API support for AutoRest v3 generators")
          ),
          cm.createNode(
            "block_quote",
            cm.createNode(
              "paragraph",
              cm.createText("see https://aka.ms/autorest")
            )
          ),
          cm.createCodeBlock(
            "yaml $(enable-multi-api)",
            yaml.dump({ "input-file": it.toArray(set) }, { lineWidth: 1000 })
          )
        )
        const x = cm.markDownExToString({ markDown: readMeMulti })
        fs.writeFile(path.join(f.dir, "readme.enable-multi-api.md"), x)
      }

@ts-common/commonmark-to-markdown

Converts commonmark AST (back) to plain markdown

MIT
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis

Similar packages