Class GfmToHtml

java.lang.Object
org.ctan.markup.gfm.GfmToHtml

public class GfmToHtml extends Object
Converts GitHub Flavored Markdown (GFM) to HTML using the commonmark-java library.

Supported GFM features:

  • Tables
  • Strikethrough (~~text~~)
  • Autolinks (bare URLs)
  • Task list items (- [x] / - [ ])
  • Named HTML entity translation via NamedEntityExtension

Usage:

   # Fragment (no HTML boilerplate):
   java -jar gfm-to-html.jar input.md

   # Full HTML document written to a file:
   java -jar gfm-to-html.jar input.md output.html
 
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a converter with all GFM extensions enabled, plus the default named-entity mappings (&TeX;, &LaTeX;, &BibTeX;).
  • Method Summary

    Modifier and Type
    Method
    Description
    process(String markdown)
    Converts a GFM string to an HTML fragment (no <html> wrapper).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GfmToHtml

      public GfmToHtml()
      Constructs a converter with all GFM extensions enabled, plus the default named-entity mappings (&TeX;, &LaTeX;, &BibTeX;).
  • Method Details

    • process

      public String process(String markdown)
      Converts a GFM string to an HTML fragment (no <html> wrapper).
      Parameters:
      markdown - the GFM source text
      Returns:
      the rendered HTML fragment