MCPcopy Create free account
hub / github.com/cli/cli / newAttachableMarkdown

Function newAttachableMarkdown

internal/attachments/references.go:67–79  ·  view source on GitHub ↗

newAttachableMarkdown scans markdown for the files it references, and refuses references that no asset URL can fix.

(md string, attachmentArgs []attachmentArg)

Source from the content-addressed store, hash-verified

65// newAttachableMarkdown scans markdown for the files it references, and
66// refuses references that no asset URL can fix.
67func newAttachableMarkdown(md string, attachmentArgs []attachmentArg) (attachableMarkdown, error) {
68 if len(attachmentArgs) == 0 {
69 return attachableMarkdown{markdown: md}, nil
70 }
71 refs, err := scanMarkdownRefs(md, attachmentArgs)
72 if err != nil {
73 return attachableMarkdown{}, err
74 }
75 if err := checkVideoReferenceImages(refs, attachmentArgs); err != nil {
76 return attachableMarkdown{}, err
77 }
78 return attachableMarkdown{markdown: md, refs: refs, args: attachmentArgs}, nil
79}
80
81// attachAssetsToMarkdown points every markdown reference to an attached file
82// at that file's asset URL, and reports which arguments the markdown never

Callers 4

UploadAndAttachMethod · 0.85

Calls 2

scanMarkdownRefsFunction · 0.85

Tested by 3