Using Markdown to create content

Markdown conundrum

Have had first-class markdown support in core on the agenda for the last few years. Unfortunately, finding a generic solution and a sponsor has been elusive.

Use Cases

Before we get to implementation options, these are the Use Cases i’ve been looking at:

Scenario one: complete replacement of richtext
Client has a thing for markdown; all rich text areas need to be replaced with text boxes.

Scenario two: replace some rich text areas with markdown
Client wants some specific properties enabled with markdown

Scenario three: mixed editor choices
Some editors want markdown, others want to fall back to rich text

Problems

The implementation problems:

  • presenting a formtool to users that enables markdown
  • storing markdown/html in the database and roundtrip parsing
  • rendering markdown in the view

Possible Plugin Approaches

Scenario one

  • override ./formtools/richtext.cfc with an editor dedicated to Markdown (or TextArea); this will replace all RTF editors
  • store all data as markdown
  • use a post-processor on the view to render property as HTML

Scenario two

  • add a new ./formtools/markdown.cfc with an editor dedicated to Markdown (or TextArea)
  • update relevant properties to use the markdown form tool
  • store specific property as markdown
  • use a post-processor on the view to render property as HTML

Scenario three

  • add a new ./formtools/markdown.cfc with an editor dedicated to Markdown (or TextArea)
  • provide a switch in the UI for users to select an editor
  • store data as either HTML or markdown; round trip to and from markdown is likely to be less than perfect
  • if data is stored as markdown, use a post-processor on the view to render property as HTML

Note this Scenario significantly increases effort here; probably something that should be sidelined until there is a need for it.

Markdown Checklist

Anyone have a good recommendation for Markdown processing in Java?

  • must handle GitHub markdown extensions; namely fenced code blocks
  • java class; rather than something like pandoc

A pure-Java Markdown processor based on a parboiled PEG parser supporting a number of extensions

I think this covers off everything I’d want in a Markdown processor :smile: h/t @faruk