Building Markdown files

So, now I’ve got all of the elements that I want (other than comments… that’s going to have to wait for another post). Time to put them together.

What I’d really like is a file in markdown, since that’s much more portable to other contexts. The hardest part is inserting the links in the right place.

The way I’m doing this is perhaps a bit hacky… just find-replace with the link content. I used to put links on single words, so this might not be perfect, but, well, it’s easy and I don’t have time to figure out a better solution.

Links in markdown are square bracketed, followed by the link in parentheses, so

function addlink(content, linknode)
    link = first(attributes(linknode)).content
    linktext = linknode.content
    return replace(content, linktext=>"[$linktext]($link)")
end

This will also end up nesting links if the same text is linked twice in a post, but if that happens (and if I ever notice), I’ll just fix it manually.

Research Scientist

I study the human microbiome, love microbial communities, and code in julia.