How to use markdown-table - 10 common examples

To help you get started, we’ve selected a few markdown-table 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 mosjs / mos / packages / mos-core / src / stringify / visitors / table.ts View on Github external
const visitor: SpecificVisitor = (compiler, node) => {
  let index = node.children.length
  compiler.context.inTable = true
  const result: string[][] = []

  while (index--) {
    result[index] = compiler.all(node.children[index])
  }

  compiler.context.inTable = false

  const start = compiler.options.looseTable
    ? ''
    : compiler.options.spacedTable ? '| ' : '|'

  return table(result, {
    align: node.align,
    start,
    end: start.split('').reverse().join(''),
    delimiter: compiler.options.spacedTable ? ' | ' : '|',
  })
}
github sketch-hq / sketch-reference-files / scripts / update-readme.ts View on Github external
const updateReadme = async () => {
  let content = ''
  for (const { document, sketchVersions } of [...versions].reverse()) {
    content += `### Document ${document}\n\n`
    content += `> Sketch versions: ${sketchVersions
      .map(versionTuple => versionTuple[0])
      .join(', ')}\n\n`
    const repoUri = `https://github.com/sketch-hq/sketch-reference-files/tree/v${pkg.version}/files`
    content += mdTable([
      ['Feature', 'Document', 'Pages', 'Meta', 'User'],
      ...features.map(feature => {
        const exists = existsSync(`./files/${document}/${feature.id}`)
        return exists
          ? [
              feature.name,
              `[🔗](${repoUri}/${document}/${feature.id}/document.json)`,
              `[🔗](${repoUri}/${document}/${feature.id}/pages)`,
              `[🔗](${repoUri}/${document}/${feature.id}/meta.json)`,
              `[🔗](${repoUri}/${document}/${feature.id}/user.json)`,
            ]
          : [feature.name, '-', '-', '-', '-']
      }),
    ])
    content += '\n\n'
  }
github jdeal / qim / benchmark.js View on Github external
suite.on('complete', function () {
      const benchesByKey = this.reduce((result, bench) => {
        result[testsByName[bench.name].key] = bench;
        return result;
      }, {});
      const table = markdownTable([
        ['Test', 'Ops/Sec'],
        ...this.map(bench =>
          [bench.name, Number(Math.round(bench.hz)).toLocaleString()]
        )
      ], {
        align: ['l', 'r']
      });
      output.push(table + '\n');
      const comparisons = fp.flatten(Object.keys(benchesByKey)
        .map(key => {
          const test = testsByKey[key];
          const bench = benchesByKey[key];
          if (test.compare) {
            return Object.keys(test.compare)
              .map(otherKey => {
                const compareBench = benchesByKey[otherKey];
github bdash-app / bdash / app / renderer / components / query_result / query_result.js View on Github external
handleClickCopyAsMarkdown() {
    this.setState({ openShareFlyout: false });
    electron.clipboard.writeText(markdownTable(this.getTableData()));
  }
github dazejs / daze / tools / benchmarks / benchmarks.ts View on Github external
const child = childProcess.spawn('node', [_targetPath], {
    stdio: 'inherit',
  });
  await sleep(2000)

  benchmarksMDStream.write('\n')
  benchmarksMDStream.write(`### ${lib}\n`)
  benchmarksMDStream.write('\n')

  const { requests, throughput } = await autocannon({
    ...opt,
    url,
  })
  child.kill()

  benchmarksMDStream.write(table([
    ['Stat', 'Avg', 'Stdev', 'Min'],
    ['Req/Sec', requests.average, requests.stddev, requests.min],
    ['Bytes/Sec', size(throughput.average), size(requests.stddev), size(requests.min)]
  ]))
  benchmarksMDStream.write('\n')
  benchmarksMDStream.write('\n')
}
github weseek / growi / src / client / js / models / MarkdownTable.js View on Github external
toString() {
    return markdownTable(this.table, this.options);
  }
github zerobias / effector / tasks / hooks.js View on Github external
.map(({name, description}) => {
      const mdHeader = `### ${description}`
      const data = packagesByCategory.get(name) || []
      const rawTable = [
        ['Package', 'Version', 'Dependencies'],
        ...data.map(pkg => [
          `[\`${pkg.name}\`](${pkg.name})`,
          npmVersionBadge(pkg.name),
          npmDepsBadge(pkg.name),
        ]),
      ]
      const mdTable = table(rawTable, {align: 'c'})
      return `

${mdHeader}

${mdTable}
`
    })
    .join('\n')}
github smooth-code / bundle-analyzer / apps / server / src / modules / build-check / checks / sizeLimit.js View on Github external
function getGithubCheckInfo(report) {
  if (!report.checks.length) {
    return {
      title: 'No size check',
      summary:
        'There is no size check configured on the project. See [documentation to learn how to configure size checks](https://docs.bundle-analyzer.com).',
    }
  }
  const table = markdownTable([
    ['Asset', 'Size', 'Max size', 'Status'],
    ...report.checks.map(check => [
      check.name,
      `${filesize(check.compareSize)} (${getCompressionLabel(
        check.compareCompression,
      )})`,
      `${filesize(check.compareMaxSize)} (${getCompressionLabel(
        check.compareCompression,
      )}`,
      check.conclusion,
    ]),
  ])
  const title =
    report.conclusion === 'success' ? 'Assets all good.' : 'Assets too big.'
  return { title, summary: table }
}
github microsoft / fluent-ui-react / build / gulp / tasks / perf.ts View on Github external
const createMarkdownTable = (
  perExamplePerfMeasures: PerExamplePerfMeasures,
  metricName: MeasuredValues = 'actualTime',
  fields: NumberPropertyNames[] = ['min', 'avg', 'median', 'max'],
) => {
  const exampleMeasures = _.mapValues(
    perExamplePerfMeasures,
    exampleMeasure => exampleMeasure[metricName],
  )

  const fieldLabels: string[] = _.map(fields, _.startCase)
  const fieldValues = _.mapValues(exampleMeasures, exampleMeasure =>
    _.flatMap(fields, field => exampleMeasure[field]),
  )

  return markdownTable([
    ['Example', ...fieldLabels],
    ..._.map(exampleMeasures, (exampleMeasure, exampleName) => [
      exampleName,
      ...fieldValues[exampleName],
    ]),
  ])
}
github segmentio / analytics-react-native / packages / integrations / src / gen-readme.ts View on Github external
import mdtable from 'markdown-table'
import fs from 'fs'
import path from 'path'

import integrations from './integration-list'

const YES = ':white_check_mark:'
const NO = ':x:'

const table: string = mdtable([
	['Name', 'iOS', 'Android', 'npm package'],
	...integrations
		.sort((a, b) => a.name.localeCompare(b.name))
		.map(({ name, npm, android, ios }) => [
			`[${name}](https://www.npmjs.com/package/${npm.package})`,
			ios.disabled ? NO : YES,
			android.disabled ? NO : YES,
			'`' + npm.package + '`'
		])
])

const readme = path.resolve(__dirname, '../../../README.md')

fs.writeFileSync(
	readme,
	fs

markdown-table

Generate a markdown (GFM) table

MIT
Latest version published 2 months ago

Package Health Score

74 / 100
Full package analysis

Popular markdown-table functions