Re: Issue with parsing Markdown headers as XML

Hussein Shafie <[email protected]> Wed, 8 Oct 2025 09:50:11 +0200
Newsgroups gmane.editors.xxe.general
Message-ID <[email protected]>
Leif wrote:
> This relates to XXE 11.0, and I tested it on XHTML documents.
 > > The documentation and the release notes says that markdown headings is
> one of the features that the new feature Parse Markdown as XML does support.
> 
> However, when I test this it, I am only able to convert inline
> elements,. such as bold and italic text. Actually, I only looked
> (closely) at the conversion of markdown headings, so at least that does
> not work, AFAIK, but my suspicion is that that it is is the same issue
> with all block level markdown.

I cannot reproduce the issue you describe with an XHTML document.

It works only inside a <p> (*only* a <p>; not a <div> for example) for 
and the very first characters of this <p> must be a number of '#' for 
headings, '*' or '-' for unordered lists and '1.' for ordered lists.

Note that conversion to headings is not supported by all document types. 
This depends on the parametrization found in system property "$c 
markdownMapping". See 
https://www.xmlmind.com/xmleditor/_distrib/doc/commands/unmarkdown.html

=============================================================
XHTML, conversion to headings is supported for <p>:
=============================================================
   <property name="$c markdownMapping">
     italic={http://www.w3.org/1999/xhtml}em
     bold={http://www.w3.org/1999/xhtml}strong
  
boldItalic={http://www.w3.org/1999/xhtml}strong/{http://www.w3.org/1999/xhtml}em
     code={http://www.w3.org/1999/xhtml}code
     strikethrough={http://www.w3.org/1999/xhtml}del
     highlight={http://www.w3.org/1999/xhtml}mark
     subscript={http://www.w3.org/1999/xhtml}sub
     superscript={http://www.w3.org/1999/xhtml}sup

     link={http://www.w3.org/1999/xhtml}a[href="${href}" title="${title}"]
     image={http://www.w3.org/1999/xhtml}img[src="${src}" alt="${alt}" 
title="${title}"]

     paragraph={http://www.w3.org/1999/xhtml}p

     heading1={http://www.w3.org/1999/xhtml}h1
     heading2={http://www.w3.org/1999/xhtml}h2
     heading3={http://www.w3.org/1999/xhtml}h3
     heading4={http://www.w3.org/1999/xhtml}h4
     heading5={http://www.w3.org/1999/xhtml}h5
     heading6={http://www.w3.org/1999/xhtml}h6

  
listItem={http://www.w3.org/1999/xhtml}ul/{http://www.w3.org/1999/xhtml}li
  
orderedListItem={http://www.w3.org/1999/xhtml}ol/{http://www.w3.org/1999/xhtml}li
   </property>
=============================================================

==================================================================
DocBook 4 or 5+, conversion to headings is supported for <para>, <simpara>:
==================================================================
   <property name="$c markdownMapping">
     italic=emphasis
     bold=emphasis[role="bold"]
     code=literal
     highlight=emphasis[role="underline"]
     subscript=subscript
     superscript=superscript

     link=ulink[url="${href}"]
     internalLink=link[linkend="${href.fragment}"]
     image=inlinemediaobject/imageobject/imagedata[fileref="${src}"]

     paragraph=para simpara

     heading1=bridgehead[renderas=sect1]
     heading2=bridgehead[renderas=sect2]
     heading3=bridgehead[renderas=sect3]
     heading4=bridgehead[renderas=sect4]
     heading5=bridgehead[renderas=sect5]
     listItem=itemizedlist[spacing=compact]/listitem/para
     orderedListItem=orderedlist[spacing=compact]/listitem/para
   </property>
==================================================================

=============================================================
DITA Topic, conversion to headings is NOT supported:
=============================================================
   <property name="$c markdownMapping">
     italic=i
     bold=b
     boldItalic=b/i
     code=tt
     highlight=u
     subscript=sub
     superscript=sup

     link=xref[href="${href}" scope="external"]
     internalLink=xref[href="${href}"]
     image=image[href="${src}" alt="${alt}"]

     paragraph=p

     listItem=ul[compact=yes]/li
     orderedListItem=ol[compact=yes]/li
   </property>
=============================================================

=============================================================
TEI Lite, conversion to headings is NOT supported:
=============================================================
   <property name="$c markdownMapping">
     italic={http://www.tei-c.org/ns/1.0}emph
     bold={http://www.tei-c.org/ns/1.0}hi[rend=bold]
  
boldItalic={http://www.tei-c.org/ns/1.0}hi[rend=bold]/{http://www.tei-c.org/ns/1.0}emph
     code={http://www.tei-c.org/ns/1.0}code
     strikethrough={http://www.tei-c.org/ns/1.0}hi[rend=strikethrough]
     highlight={http://www.tei-c.org/ns/1.0}hi[rend=underline]
     subscript={http://www.tei-c.org/ns/1.0}hi[rend=subscript]
     superscript={http://www.tei-c.org/ns/1.0}hi[rend=superscript]

     link={http://www.tei-c.org/ns/1.0}ref[target="${href}"]
     image={http://www.tei-c.org/ns/1.0}graphic[url="${src}"]

     paragraph={http://www.tei-c.org/ns/1.0}p

  
listItem={http://www.tei-c.org/ns/1.0}list[rend=bulleted]/{http://www.tei-c.org/ns/1.0}item
  
orderedListItem={http://www.tei-c.org/ns/1.0}list[rend=numbered]/{http://www.tei-c.org/ns/1.0}item
   </property>
=============================================================


--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support