Skip to content

Instantly share code, notes, and snippets.

@elbow-jason
Created April 24, 2020 16:13
Show Gist options
  • Save elbow-jason/f1dde203443a62485896d3e52b605fb8 to your computer and use it in GitHub Desktop.
Save elbow-jason/f1dde203443a62485896d3e52b605fb8 to your computer and use it in GitHub Desktop.
SNIPPET: readme as moduledoc
defmodule Thing do
# get the full qualified path to the README.
@readme_path Path.join(__DIR__, "../README.md")
# ensure the module recompiles if the README changes
# NOTE: @external_resource requires a fully qualified path.
@external_resource @readme_path
# read the README into the moduledoc
@moduledoc File.read!(@readme_path)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment