[julia-users] Re: Command line help documentation

2015-08-26 Thread Benjamin Deonovic
I found my answer. In Julia 0.4 you have access to the doc macro:

help? @doc
 Documentation
≡≡≡

  Functions, methods and types can be documented by placing a string before the
  definition:

  
  # The Foo Function
  `foo(x)`: Foo the living hell out of `x`.
  
  foo(x) = ...

  The @doc macro can be used directly to both set and retrieve documentation /
  metadata. By default, documentation is written as Markdown, but any object 
can be
  placed before the arrow. For example:

  @doc blah -
  function foo() ...

  The - is not required if the object is on the same line, e.g.

  @doc foo foo

 Documenting objects after they are defined


  You can document an object after its definition by

  @doc foo function_to_doc
  @doc bar TypeToDoc

  For macros, the syntax is @doc macro doc :(@Module.macro) or @doc macro 
doc
  :(string_macro) for string macros. Without the quote :() the expansion of 
the macro
  will be documented.

 Retrieving Documentation
==

  You can retrieve docs for functions, macros and other objects as follows:

  @doc foo
  @doc @time
  @doc md

 Functions  Methods
=

  Placing documentation before a method definition (e.g. function foo() ... or 
foo() =
  ...) will cause that specific method to be documented, as opposed to the whole
  function. Method docs are concatenated together in the order they were 
defined to
  provide docs for the function.


On Wednesday, August 26, 2015 at 11:12:54 AM UTC-5, Benjamin Deonovic wrote:

 How can I get documentation for my functions in my package to show up when 
 someone uses the command line help functionality 

 like:


 help? sort 
 INFO: Loading help data...
 Base.sort(v, [alg=algorithm,] [by=transform,] [lt=comparison,] [rev=
 false]) 
  
  Variant of sort! that returns a sorted copy of v leaving 
  v itself unmodified. 
  
 Base.sort(A, dim, [alg=algorithm,] [by=transform,] [lt=comparison,] 
 [rev=false]) 
  
  Sort a multidimensional array A along the given dimension. 
  
 julia 





Re: [julia-users] Re: Command line help documentation

2015-08-26 Thread Stefan Karpinski
In particular, unless you have special requirements, you can just put a
bare string in front of a method definition to document it. Let us know how
it works and if you have an problems or confusion – feedback from brand new
users of features is very helpful!

On Wed, Aug 26, 2015 at 2:56 PM, Benjamin Deonovic bdeono...@gmail.com
wrote:

 I found my answer. In Julia 0.4 you have access to the doc macro:

 help? @doc
  Documentation
 ≡≡≡

   Functions, methods and types can be documented by placing a string before 
 the
   definition:

   
   # The Foo Function
   `foo(x)`: Foo the living hell out of `x`.
   
   foo(x) = ...

   The @doc macro can be used directly to both set and retrieve documentation /
   metadata. By default, documentation is written as Markdown, but any object 
 can be
   placed before the arrow. For example:

   @doc blah -
   function foo() ...

   The - is not required if the object is on the same line, e.g.

   @doc foo foo

  Documenting objects after they are defined
 

   You can document an object after its definition by

   @doc foo function_to_doc
   @doc bar TypeToDoc

   For macros, the syntax is @doc macro doc :(@Module.macro) or @doc macro 
 doc
   :(string_macro) for string macros. Without the quote :() the expansion of 
 the macro
   will be documented.

  Retrieving Documentation
 ==

   You can retrieve docs for functions, macros and other objects as follows:

   @doc foo
   @doc @time
   @doc md

  Functions  Methods
 =

   Placing documentation before a method definition (e.g. function foo() ... 
 or foo() =
   ...) will cause that specific method to be documented, as opposed to the 
 whole
   function. Method docs are concatenated together in the order they were 
 defined to
   provide docs for the function.


 On Wednesday, August 26, 2015 at 11:12:54 AM UTC-5, Benjamin Deonovic
 wrote:

 How can I get documentation for my functions in my package to show up
 when someone uses the command line help functionality

 like:


 help? sort
 INFO: Loading help data...
 Base.sort(v, [alg=algorithm,] [by=transform,] [lt=comparison,] [rev
 =false])

  Variant of sort! that returns a sorted copy of v leaving
  v itself unmodified.

 Base.sort(A, dim, [alg=algorithm,] [by=transform,] [lt=comparison,]
 [rev=false])

  Sort a multidimensional array A along the given dimension.

 julia