Class MarkDownProcessor

java.lang.Object
org.hl7.fhir.utilities.MarkDownProcessor

public class MarkDownProcessor extends Object
  • Constructor Details

  • Method Details

    • process

      public String process(String source, String context)
    • isProbablyMarkdown

      public boolean isProbablyMarkdown(String content, boolean mdIfParagrapghs)
      Returns true if this is intended to be processed as markdown this is guess, based on textual analysis of the content. Uses of this routine: In general, the main use of this is to decide to escape the string so erroneous markdown processing doesn't munge characters If it's a plain string, and it's being put into something that's markdown, then you should escape the content If it's markdown, but you're not sure whether to process it as markdown The underlying problem is that markdown processing plain strings is problematic because some technical characters might get lost. So it's good to escape them... but if it's meant to be markdown, then it'll get trashed. This method works by looking for character patterns that are unlikely to occur outside markdown - but it's still only unlikely
      Parameters:
      content -
      Returns:
    • preProcess

      public static String preProcess(String source)
      This deals with a painful problem created by the intersection of previous publishing processes and the way commonmark specifies that < is handled in content. For control reasons, the FHIR specification does not allow raw html tags in the markdown This check finds any raw html tag and prepends \ to it so that it renders as a < (e.g. gets escaped in the output HTML) This is public to enable testing (not for direct use otherwise)
      Parameters:
      source -
      Returns:
    • isSimpleMarkdown

      public static boolean isSimpleMarkdown(String description)
    • makeStringSafeAsMarkdown

      public static String makeStringSafeAsMarkdown(String content)
    • makeMarkdownForString

      public static String makeMarkdownForString(String content)
    • markdownToPlainText

      public static String markdownToPlainText(String source)