Skip to content

convert html tags in markdown to word equivalents #10840

Answered by rnwst
Triquetra asked this question in Q&A
Discussion options

You must be logged in to vote

It is always a good idea to include a sample Markdown snippet and the exact command you're running!

Pandoc should parse the tags as RawInlines. Say test.md contains

<u>unarticulated</u> and <i>idiomatic</i> text

, then this is parsed via pandoc test.md -t native into the following AST:

[ Para
    [ RawInline (Format "html") "<u>"
    , Str "unarticulated"
    , RawInline (Format "html") "</u>"
    , Space
    , Str "and"
    , Space
    , RawInline (Format "html") "<i>"
    , Str "idiomatic"
    , RawInline (Format "html") "</i>"
    , Space
    , Str "text"
    ]
]

This Lua filter should do what you want:

---@param inlines Inlines
---@return Inlines | nil
function Inlines(inlines)
   --

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@rnwst
Comment options

Answer selected by Triquetra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants