This repository was archived by the owner on Sep 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -319,6 +319,20 @@ private extension Element {
319319 }
320320}
321321
322+ private func emptyDescription( options: CMarkOptions ) -> ListDiffable {
323+ let builder = StyledTextBuilder . markdownBase ( )
324+ . add (
325+ text: NSLocalizedString ( " No description provided. " , comment: " " ) ,
326+ traits: . traitItalic,
327+ attributes: [ . foregroundColor: Styles . Colors. Gray. medium. color]
328+ )
329+ return StyledTextRenderer (
330+ string: builder. build ( ) ,
331+ contentSizeCategory: options. contentSizeCategory,
332+ inset: IssueCommentTextCell . inset
333+ ) . warm ( width: options. width)
334+ }
335+
322336func MarkdownModels(
323337 _ markdown: String ,
324338 owner: String ,
@@ -342,6 +356,11 @@ func MarkdownModels(
342356 viewerCanUpdate: viewerCanUpdate,
343357 contentSizeCategory: contentSizeCategory
344358 )
345- return node. flatElements. compactMap { $0. model ( options) }
359+ let models = node. flatElements. compactMap { $0. model ( options) }
360+ if models. count == 0 {
361+ return [ emptyDescription ( options: options) ]
362+ } else {
363+ return models
364+ }
346365}
347366
You can’t perform that action at this time.
0 commit comments