[][src]Function bloguen::util::extract_actual_assets

pub fn extract_actual_assets<'a, P: AsRef<Path>>(
    post_source_dir: P,
    ast: &'a ComrakAstNode<'a>
) -> Result<Vec<&'a mut Vec<u8>>, Error>

Get a list of all actual (i.e. existant) assets in the specified AST.

Examples

Given the following directory layout:

$ROOT/
  image.png

The following holds:

let root: PathBuf = /* obtained elsewhere */;
let mut alloc = comrak::Arena::new();

let mut ast =
    comrak::parse_document(&alloc, r#"[link](link.html)
                                      ![img](image.png)"#, &MARKDOWN_OPTIONS);
assert_eq!(extract_actual_assets(&root, &mut ast), Ok(vec![&mut b"image.png".to_vec()]));