Add support for the @doc macro in versions < 0.4-dev

Based on suggestion from @timholy in pull request