Reputation: 166
I am following the tutorial of the docs, example-modified-markdown-writer
I want to try it against the following file
input01.html
<body>
<h1>My Document</h1>
<code>
This code will be recognised
</code>
</body>
custom-write01A.lua
function Writer (doc, opts)
local filter = {
CodeBlock = function (cb)
-- only modify if code block has no attributes
if cb.attr == pandoc.Attr() then
local delimited = '```\n' .. cb.text .. '\n```'
return pandoc.RawBlock('markdown', delimited)
end
end
}
return pandoc.write(doc:walk(filter), 'gfm', opts)
end
Template = pandoc.template.default 'gfm'
Now I can do the default markdown processing by
pandoc -f html -t markdown input01.html
Or I could be picking the custom writer
pandoc -f html input01.html -L custom-writer01.lua
Which is giving me
<h1 id="my-document">My Document</h1>
<p><code> This code will be recognised </code></p>
I was expecting the output in the gfm
I expected the output to be as specified per code (In a fenced code block)
# My Document
```
This code will be recognised
```
Instead we get the in-line codeblock as the same as in -t markdown
# My Document
` This code will be recognised `
Upvotes: 0
Views: 37