format code blocks and make links relative from base