public void emit (final MarkdownHCStack aOut, final Block aRoot)
  {
    aRoot.removeSurroundingEmptyLines ();
    final IMarkdownDecorator aDecorator = m_aConfig.getDecorator ();

    switch (aRoot.m_eType)
    {
      case RULER:
        aDecorator.appendHorizontalRuler (aOut);
        return;
      case NONE:
      case XML:
      case XML_COMMENT:
        // No open required
        break;
      case HEADLINE:
        final IHCElementWithChildren <?> aHX = aDecorator.openHeadline (aOut, aRoot.m_nHeadlineDepth);
        if (m_bUseExtensions && aRoot.m_sID != null)
          aHX.setID (aRoot.m_sID);
        break;
      case PARAGRAPH:
        aDecorator.openParagraph (aOut);
        break;
      case CODE:
      case FENCED_CODE:
        if (m_aConfig.getCodeBlockEmitter () == null)
          aDecorator.openCodeBlock (aOut);
        break;
      case BLOCKQUOTE:
        aDecorator.openBlockquote (aOut);
        break;
      case UNORDERED_LIST:
        aDecorator.openUnorderedList (aOut);
        break;
      case ORDERED_LIST:
        aDecorator.openOrderedList (aOut);
        break;
      case LIST_ITEM:
        final HCLI aLI = aDecorator.openListItem (aOut);
        if (m_bUseExtensions && aRoot.m_sID != null)
          aLI.setID (aRoot.m_sID);
        break;
      default:
        break;
    }

    if (aRoot.hasLines ())
    {
      _emitLines (aOut, aRoot);
    }
    else
    {
      Block aBlock = aRoot.m_aBlocks;
      while (aBlock != null)
      {
        emit (aOut, aBlock);
        aBlock = aBlock.m_aNext;
      }
    }

    switch (aRoot.m_eType)
    {
      case RULER:
      case NONE:
      case XML:
      case XML_COMMENT:
        break;
      case HEADLINE:
        aDecorator.closeHeadline (aOut, aRoot.m_nHeadlineDepth);
        break;
      case PARAGRAPH:
        aDecorator.closeParagraph (aOut);
        break;
      case CODE:
      case FENCED_CODE:
        if (m_aConfig.getCodeBlockEmitter () == null)
          aDecorator.closeCodeBlock (aOut);
        break;
      case BLOCKQUOTE:
        aDecorator.closeBlockquote (aOut);
        break;
      case UNORDERED_LIST:
        aDecorator.closeUnorderedList (aOut);
        break;
      case ORDERED_LIST:
        aDecorator.closeOrderedList (aOut);
        break;
      case LIST_ITEM:
        aDecorator.closeListItem (aOut);
        break;
      default:
        break;
    }
  }
public void emit ( final MarkdownHCStack aOut , final Block aRoot ) { aRoot . removeSurroundingEmptyLines ( ) ; final IMarkdownDecorator aDecorator = m_aConfig . getDecorator ( ) ; switch ( aRoot . m_eType ) { case RULER : aDecorator . appendHorizontalRuler ( aOut ) ; return ; case NONE : case XML : case XML_COMMENT : break ; case HEADLINE : final IHCElementWithChildren < ? > aHX = aDecorator . openHeadline ( aOut , aRoot . m_nHeadlineDepth ) ; if ( m_bUseExtensions && aRoot . m_sID != null ) aHX . setID ( aRoot . m_sID ) ; break ; case PARAGRAPH : aDecorator . openParagraph ( aOut ) ; break ; case CODE : case FENCED_CODE : if ( m_aConfig . getCodeBlockEmitter ( ) == null ) aDecorator . openCodeBlock ( aOut ) ; break ; case BLOCKQUOTE : aDecorator . openBlockquote ( aOut ) ; break ; case UNORDERED_LIST : aDecorator . openUnorderedList ( aOut ) ; break ; case ORDERED_LIST : aDecorator . openOrderedList ( aOut ) ; break ; case LIST_ITEM : final HCLI aLI = aDecorator . openListItem ( aOut ) ; if ( m_bUseExtensions && aRoot . m_sID != null ) aLI . setID ( aRoot . m_sID ) ; break ; default : break ; } if ( aRoot . hasLines ( ) ) { _emitLines ( aOut , aRoot ) ; } else { Block aBlock = aRoot . m_aBlocks ; while ( aBlock != null ) { emit ( aOut , aBlock ) ; aBlock = aBlock . m_aNext ; } } switch ( aRoot . m_eType ) { case RULER : case NONE : case XML : case XML_COMMENT : break ; case HEADLINE : aDecorator . closeHeadline ( aOut , aRoot . m_nHeadlineDepth ) ; break ; case PARAGRAPH : aDecorator . closeParagraph ( aOut ) ; break ; case CODE : case FENCED_CODE : if ( m_aConfig . getCodeBlockEmitter ( ) == null ) aDecorator . closeCodeBlock ( aOut ) ; break ; case BLOCKQUOTE : aDecorator . closeBlockquote ( aOut ) ; break ; case UNORDERED_LIST : aDecorator . closeUnorderedList ( aOut ) ; break ; case ORDERED_LIST : aDecorator . closeOrderedList ( aOut ) ; break ; case LIST_ITEM : aDecorator . closeListItem ( aOut ) ; break ; default : break ; } }
Transforms the given block recursively into HTML.

@param aOut
The StringBuilder to write to.
@param aRoot
The Block to process.