Note that there are some explanatory texts on larger screens.

plurals
  1. POIs Pandoc capable of injecting arbitrary HTML attributes to any elements?
    text
    copied!<p>So code blocks can define HTML attributes using the <code>fenced_code_blocks</code> extension:</p> <pre><code>~~~~ {#mycode .haskell .numberLines startFrom="100"} qsort [] = [] qsort (x:xs) = qsort (filter (&lt; x) xs) ++ [x] ++ qsort (filter (&gt;= x) xs) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ </code></pre> <p>Is it possible to use the above syntax, in some way, for regular text blocks? For example, I'd like to convert the following Markdown text:</p> <pre><code># My header ~~~ {.text} This is regular text. This is regular text. ~~~ ~~~ {.quote} &gt; This is the first level of quoting. &gt; &gt; &gt; This is nested blockquote. &gt; &gt; Back to the first level. ~~~ ~~~ {data-id=test-123} + Red + Green + Blue ~~~ </code></pre> <p>into something like this:</p> <pre><code>&lt;h1 id="my-header"&gt;My header&lt;/h1&gt; &lt;p class="text"&gt;This is regular text. This is regular text.&lt;/p&gt; &lt;blockquote class="quote"&gt; &lt;p&gt;This is the first level of quoting.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;This is nested blockquote.&lt;/p&gt; &lt;/blockquote&gt; &lt;p&gt;Back to the first level.&lt;/p&gt; &lt;/blockquote&gt; &lt;ul data-id="test-123"&gt; &lt;li&gt;Red&lt;/li&gt; &lt;li&gt;Green&lt;/li&gt; &lt;li&gt;Blue&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>If there is no such support in Pandoc itself, would it be possible to create a custom writer in Lua that does so?</p> <p><strong>Edit:</strong> Looking at the <a href="https://github.com/jgm/pandoc/blob/master/data/sample.lua">sample.lua</a> custom writer, anyone know what the "attributes table" is on line 35? And how does one pass these attributes to specific Pandoc elements? Also, the functionality I'm looking for above is very similar to the <a href="http://johnmacfarlane.net/pandoc/README.html#header-identifiers-in-html-latex-and-context"><code>header_extension</code></a> extension except it would work for all elements, not just headers.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload