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

Function newAttachableMarkdown

internal/attachments/references.go:70–82  ·  view source on GitHub ↗

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

(md, markdownDir string, attachmentArgs []attachmentArg)

Source from the content-addressed store, hash-verified

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

Callers 4

newAttachableDocumentsFunction · 0.85

Calls 2

scanMarkdownRefsFunction · 0.85

Tested by 3