On Thu, Jun 30, 2022 at 07:22:12PM +0100, Ashley Smith wrote:
>Unfortunately, what you just described isn't what I'm experiencing.
>Having the word 'section' as the classname DOES NOT create a section at
>all.
My bad -- I only tested a simple example with plain text inside a <div
class="section">; that does produce a <section>. I then immediately got
suspicious about the class name, found code that handles it, and
concluded that it is the cause of the issue. Now I also tried your full
example, reproducing the problem like this:
$ pandoc --version
pandoc 2.9.2.1
Compiled with pandoc-types 1.20, texmath 0.12.0.2, skylighting 0.8.5
(snip)
$ pandoc -f native -t html
Div
( "myownid"
, ["section"]
, []
)
[ Header
1
("", ["anchor-header"], [])
[ Span ("", [], []) [Str "Hello"]
, Link
("", ["anchor", "las", "la-link"], [])
[]
("#myownid", "myownid")
]
]
<h1 class="anchor-header" id="myownid"><span>Hello</span><a href="#myownid" class="anchor las la-link" title="myownid"></a></h1>
(I pressed Enter and Control-D after typing the Haskell code, and Pandoc
printed out HTML.)
Same for your other example, the one that adds "anchor-header" class
both to <section> and <h1>:
$ pandoc -f native -t html
Div ("myownid", [""], []) [Header 1 ("", ["anchor-header"], []) [Span ("", [], []) [Str "Hello"], Link ("", ["anchor", "las", "la-link"], []) [] ("#myownid", "myownid")]]
<section id="myownid" class="anchor-header "><h1 class="anchor-header"><span>Hello</span><a href="#myownid" class="anchor las la-link" title="myownid"></a></h1></section>
So yeah, you're right, <section> is missing if class "section" is used.
I don't know why, though. Have you tried asking in Pandoc's help
channels?
https://pandoc.org/help.html
>I'm trying to understand why I don't have the control over the dom that
>I'm expecting.
I fear the answer would be that you're expecting a bit too much. Pandoc
is a converter first and foremost. If you need tight control over the
resulting DOM, you should probably create a custom Pandoc writer. (But
I'm not an expert, so please do ask on the Pandoc user group to see if
they have better ideas.)