blackode
How to add images in hex package documentation with exdoc
Hi,
I generated Docs using the exdoc module.
The index.html is showing the images when I checked offline,but when I publish to the
HEX Package Manager images are not showing.
is anything to add more ?
if not possible with exdoc please specify an alternative.
Screenshot
Thanks in Advance ![]()
Marked As Solved
ericmj
You need to put the images inside the doc/ directory. Hex only pushes things inside that directory to hexdocs [1], we do not traverse the markdown to resolve links to resources anywhere on your filesystem. You might also want to copy the images inside an alias [2] on the docs task that runs after ex_doc to ensure that ex_doc does not overwrite the directory:
defp aliases do
[docs: ["docs", ©_images/1]]
end
defp copy_images(_) do
File.cp! ...
end
Last Post!
blackode
Thanks for the quick response. The above one only works to copy contents of one file to another.After looking into more with your suggestions I found the follwing code snippets which copy the contents of source to destination in the official docs
defp copy_images(_) do
File.cp_r "source", "destination", fn(source, destination) ->
IO.gets("Overwriting #{destination} by #{source}. Type y to confirm. ") == "y\n"
end
end
That really solved the problem. Thanks for that amazing stuff. Now Images are shown in the docs.
The Printex Documentation
Once again Thanks a lot.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security











