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