Allow usage of the JSDoc @example
caption
#1679
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this pull request contains
What this pull request impacts
tagLine
(@anyTag
occurences) by oneif
-condition, evaluating strict string equality (tagName === "example"
)if
an@example
is met, a RegEx-replacement will be executed on the whole line (line.replace(/<\/?caption>/g, "")
).What this pull request does
Strip
<caption></caption>
tags from@example
headings (inside the comment convertor factory).My use-case and motivation as follows.
So, I'm brewing my own small TypeScript library to season my JavaScript client with. And, of course, I want to document the exposed API to give hints inline and on some nice kitchen table like
home-brewed-soup.github.io
. As I'm trying to conform to standards, I choose the adequate*doc
format, which turns out to be TSDoc. Then I look for a nice tool to extract some nice kitchen table-ready HTML from my TSDoc comments and here I am (thank You! ❤️). As time files by, I'm getting ready to actually enrich my documentation with some nitty-gritty@example
s (recipes) and immediately hit the VSCode vs. TSDoc wall regarding the@example
(block) formatting:To demonstrate what I'm refering to, here's what happenes when applying a title to an
@example
block in VSCode (v1.59.1#3866c35):Dissapointing inline-experience. But
typedoc
does render this correctly, so no issue there. Still, I want the VSCode inline-experience to betasty
. So I looked around, ate some more soup, and found out, that JSDoc (in contrast to TSDoc) forbits the usage of captions in@example
headings. Unless! One may use the<caption></caption>
tags, to specify the@example
caption. Opened VSCode, tried this out, et voila:Very nice VSCode inline-experience, right there. And then I gave
typedoc
a go:Damn, the markdown isn't rendered (
:-(
). I did not dig through all Your code, but as I can see the<caption></caption>
tags being rendered 1:1 into the HTML output, I'd guess strings enclosed in HTML tags are considered to be pre-rendered and therefore aren't piped through the markdown parser? Which seems correnct, in any other case. But nevermind, I did dig through Your code enough to be able to provide this tiny pull request, which just adds anif
-clause at the right place to strip<caption></caption>
tags from@example
tagLine
s. After applying the patch:Yummy!
:-)