Elixir: @doc in an @clean file

41 views
Skip to first unread message

Thomas Buttler

unread,
Jan 7, 2022, 1:56:20 PM1/7/22
to leo-editor
The elixir language uses "@doc" as a documentation preamble for definitions; how does one instruct Leo to emit a verbatim "@doc"?

Collaboration with non-Leo users implies use of @clean.

zhaohe wang

unread,
Jan 9, 2022, 10:22:32 AM1/9/22
to leo-editor
I often use markdown text below @doc.

@language python
print("something")

@doc
@language md
### Print something

tbp1...@gmail.com

unread,
Jan 9, 2022, 12:16:21 PM1/9/22
to leo-editor
Leo has an elixir mode, so you could use it with

@language elixir

Are you already doing this?  It will let you emit an @adoc.  I tried it using an example I found at the ebook Learning Elixir Language.  Here is the content of my @clean node for the example:

@language elixir
defmodule MyModule do
 @doc """
 Given a number, returns `true` if the number is even, otherwise `false`.
 ## Example
 iex> MyModule.even?(2)
 true
 iex> MyModule.even?(3)
 false
 """

 def even?(number) do
 rem(number, 2) == 0
 end
end


The external file that Leo created seems to be exactly what you want.  I have attached it.
elixir_demo.exs

tbp1...@gmail.com

unread,
Jan 9, 2022, 3:31:25 PM1/9/22
to leo-editor
Sorry, typo, I meant " It will let you emit an @doc."

On Sunday, January 9, 2022 at 12:16:21 PM UTC-5 tbp1...@gmail.com wrote:
It will let you emit an @adoc.
[snip]

Edward K. Ream

unread,
Jan 10, 2022, 8:23:09 AM1/10/22
to leo-editor
On Fri, Jan 7, 2022 at 1:56 PM Thomas Buttler <thomasb...@gmail.com> wrote:
The elixir language uses "@doc" as a documentation preamble for definitions; how does one instruct Leo to emit a verbatim "@doc"?

In my tests in the latest devel code, Leo emits @doc as expected for both @file and @clean.

Edward
Reply all
Reply to author
Forward
0 new messages