GitHub Flavored Markdown Test Suite Data
The `gfm-test-suite` package, currently at version 0.0.2, provides a JavaScript representation of the GitHub Flavored Markdown (GFM) test suite. It specifically encapsulates the GFM Specification data (version 0.29-gfm, dated 2019-04-06) into a readily consumable JavaScript object. This utility allows developers to programmatically access official GFM test cases, which is invaluable for validating markdown parsers, testing rendering engines, or implementing GFM-compliant features. Its release cadence appears infrequent, with updates primarily addressing compatibility rather than introducing new features, indicating its role as a data-centric library. Its key differentiator is providing direct, structured access to this specific version of the GFM test data without requiring manual parsing of the specification document.
Warnings
- gotcha The GFM specification data included in this package is based on version 0.29-gfm, dated 2019-04-06. Newer versions of the GFM specification or GitHub's actual rendering might have evolved since this date, potentially leading to discrepancies if strict up-to-date compliance is required.
- gotcha The package is currently at a very early development version (0.0.2). While functional, this might imply a higher risk of unannounced changes in future patch or minor releases, or a lack of long-term maintenance if the author's focus shifts.
- gotcha The quickstart example in the README uses `console.log(latest)` without defining `latest`. The correct usage, implied by the output, is to log the default import `gfmTestSuite` itself or one of its properties.
Install
-
npm install gfm-test-suite -
yarn add gfm-test-suite -
pnpm add gfm-test-suite
Imports
- default
const gfmTestSuite = require('gfm-test-suite')import gfmTestSuite from 'gfm-test-suite'
- GfmTestSuiteData
import type { GfmTestSuiteData } from 'gfm-test-suite'
Quickstart
import gfmTestSuite from 'gfm-test-suite';
console.log(`GFM Spec Version: ${gfmTestSuite.version}`);
console.log(`GFM Spec Date: ${gfmTestSuite.date}`);
console.log(`Total GFM Test Cases: ${gfmTestSuite.testCases.length}`);
// Example: Access the first test case
const firstCase = gfmTestSuite.testCases[0];
if (firstCase) {
console.log('\n--- First Test Case ---');
console.log('Section:', firstCase.section.trim());
console.log('Example:', firstCase.example);
console.log('Markdown Input:\n', firstCase.markdown.trim());
console.log('Expected HTML Output:\n', firstCase.html.trim());
}