newAttachableMarkdown scans markdown for the files it references, and refuses references that no asset URL can fix.
(md string, attachmentArgs []attachmentArg)
| 65 | // newAttachableMarkdown scans markdown for the files it references, and |
| 66 | // refuses references that no asset URL can fix. |
| 67 | func 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 |