docfx icon indicating copy to clipboard operation
docfx copied to clipboard

Triple slash comment 'item' tag generates an empty list item

Open martinivanoff opened this issue 5 years ago • 8 comments

The following C# XML comment generates a list with two empty list items.

XML:

///<list type="bullet"> /// <item>Item 1</item> /// <item>Item 2</item> ///</list>

Generated YAML:

remarks: "\n<ul><li></li><li></li></ul>\n"

martinivanoff avatar Dec 05 '19 09:12 martinivanoff

See: https://docs.microsoft.com/en-us/dotnet/csharp/codedoc#list

Source code: https://github.com/dotnet/docfx/blob/dev/src/Microsoft.DocAsCode.Metadata.ManagedReference.Common/Transform/TripleSlashCommentTransform.xsl#L188

vwxyzh avatar Dec 13 '19 04:12 vwxyzh

list in Sandcastle XML Comments Guide says that, for list/@type="bullet" and list/@type="number", the inner text of the item element is rendered if the term and description child elements are omitted. "Area-SandcastleParity" might be appropriate.

KalleOlaviNiemitalo avatar Dec 16 '19 09:12 KalleOlaviNiemitalo

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs.

stale[bot] avatar Mar 15 '20 11:03 stale[bot]

Closing this issue after a prolonged period of inactivity. If you still think this issue is relevant, please feel free to ping a maintainer or leave a comment.

stale[bot] avatar Mar 22 '20 12:03 stale[bot]

It is not only Sandcastle which behaves in this way. VS Code for example (with Omnisharp) will render list contents as described in this issue. Here's a screenshot of a tool-tip from an editor.

VSCode-list-tag

I hadn't even realised that the <term> and <description> tags existed. I've been using bare <item> for so long (and supported by every tool I'd used) that I was unaware that technically I was doing anything wrong. So, I'd support including this feature based on the principle of least astonishment.

For now, though (now I know) I'm happy with the workaround that I must use term and/or description tags.

craigfowler avatar Jan 05 '21 20:01 craigfowler

I was also blindsided by this behavior, and will now have to edit the docs in quite a few projects to add <description> tags. I do see that in the current .NET language reference pages (as opposed to the Sandcastle docs), <item> is described as always requiring a <description>— so it may be that this was always a non-canonical behavior of Sandcastle. If so, that's unfortunate, since <item><description> is an extremely verbose way to write a bullet list item.

eli-darkly avatar Sep 21 '21 00:09 eli-darkly

If Visual Studio support this, I think it's fair to say that docfx should also support it.

TermWay avatar Jan 11 '22 20:01 TermWay

Nice to see a PR has been submitted to address this. It's been quite an issue for us.

dotMorten avatar Aug 12 '22 20:08 dotMorten