It seems that the marked library by default is wrapping the content it processes with p
p tags (at least, for me). Following this and checked out this (but the questions and suggestions are all quite old).
Also there is a claim in 2023 on the Github issue that “this issue has been resolved,” with no explanation of what that means (still happening for me – I am using https://cdn.jsdelivr.net/npm/marked/marked.min.js
which currently says v14.1.3
).
One user on the Github issue suggested I use marked.parseInline
…. However this seems to remove all line breaks from the content, not just the outer wrapping p
tags that marked seems to be adding.
Anyone know how to remove just the outer tags, while preserving intended line breaks in the content itself?