mat-hek

mat-hek

Membrane Core Team

How to add an .exs script to docs?

Hello, I have an .exs script with Mix.install in a repo and I’d like to include it in the docs. Putting it into extras throws an error that only markdown files are allowed. What’s the best way to include the script in the docs?

Most Liked

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

You’re trying to show the contents of the file in the docs? Would @moduledoc "#{File.read("script.exs")}" work?

christhekeele

christhekeele

AFAIK, while Earmark supports custom processing allowing you to do things like this, ExDoc does not.

I’d use @external_resource with @benwilson512’s approach to insert script code somewhere into module/function docs, or rework the script into a Livebook (which is publishable by ExDoc).

mat-hek

mat-hek

Membrane Core Team

Would @moduledoc “#{File.read(“script.exs”)}” work?

Yeah, thought about it, but to me it doesn’t really fit in the moduledoc.

I asked if exs could be supported, but apparently it cannot ¯\_(ツ)_/¯ so I’m going to just link to GitHub :wink:

Last Post!

mat-hek

mat-hek

Membrane Core Team

It’s not a hard requirement, it just feels right to me to have an exs script in an exs file. It’s not a big deal anyway :slight_smile:

Where Next?

Popular in Questions Top

ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

Other popular topics Top

grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54260 488
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49266 226
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44265 214
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

We're in Beta

About us Mission Statement