Utilities
Documenter.Utilities
— Module.Provides a collection of utility functions and types that are used in other submodules.
Documenter.Utilities.Object
— Type.Represents an object stored in the docsystem by its binding and signature.
Documenter.Utilities.assetsdir
— Method.Returns the path to the Documenter assets
directory.
Documenter.Utilities.check_kwargs
— Method.Prints a formatted warning to the user listing unrecognised keyword arguments.
Documenter.Utilities.currentdir
— Method.Returns the current directory.
Documenter.Utilities.doccat
— Method.Returns the category name of the provided Object
.
Documenter.Utilities.docs
— Function.docs(ex, str)
Returns an expression that, when evaluated, returns the docstrings associated with ex
.
Documenter.Utilities.filterdocs
— Method.filterdocs(doc, modules)
Remove docstrings from the markdown object, doc
, that are not from one of modules
.
Documenter.Utilities.get_commit_short
— Method.get_commit_short(dir)
Returns the first 5 characters of the current git commit hash of the directory dir
.
Documenter.Utilities.isabsurl
— Method.isabsurl(url)
Checks whether url
is an absolute URL (as opposed to a relative one).
Documenter.Utilities.issubmodule
— Method.issubmodule(sub, mod)
Checks whether sub
is a submodule of mod
. A module is also considered to be its own submodule.
E.g. A.B.C
is a submodule of A
, A.B
and A.B.C
, but it is not a submodule of D
, A.D
nor A.B.C.D
.
Documenter.Utilities.mdparse
— Method.mdparse(s::AbstractString; mode=:single)
Parses the given string as Markdown using Markdown.parse
, but strips away the surrounding layers, such as the outermost Markdown.MD
. What exactly is returned depends on the mode
keyword.
The mode
keyword argument can be one of the following:
:single
(default) – returns a single block-level object (e.g.Markdown.Paragraph
orMarkdown.Admonition
) and errors if the string parses into multiple blocks.:blocks
– the function returns aVector{Any}
of Markdown blocks.:span
– Returns aVector{Any}
of span-level items, stripping away the outer block. This requires the string to parse into a singleMarkdown.Paragraph
, the contents of which gets returned.
Documenter.Utilities.nodocs
— Method.Does the given docstring represent actual documentation or a no docs error message?
Documenter.Utilities.object
— Method.object(ex, str)
Returns a expression that, when evaluated, returns an Object
representing ex
.
Documenter.Utilities.parseblock
— Method.Returns a vector of parsed expressions and their corresponding raw strings.
Returns a Vector
of tuples (expr, code)
, where expr
is the corresponding expression (e.g. a Expr
or Symbol
object) and code
is the string of code the expression was parsed from.
The keyword argument skip = N
drops the leading N
lines from the input string.
If raise=false
is passed, the Meta.parse
does not raise an exception on parse errors, but instead returns an expression that will raise an error when evaluated. parseblock
returns this expression normally and it must be handled appropriately by the caller.
relpath_from_repo_root(file)
Returns the path of file
, relative to the root of the Git repository, or nothing
if the file is not in a Git repository.
Documenter.Utilities.repo_root
— Method.repo_root(file; dbdir=".git")
Tries to determine the root directory of the repository containing file
. If the file is not in a repository, the function returns nothing
.
The dbdir
keyword argument specifies the name of the directory we are searching for to determine if this is a repostory or not. If there is a file called dbdir
, then it's contents is checked under the assumption that it is a Git worktree or a submodule.
Documenter.Utilities.slugify
— Method.Slugify a string into a suitable URL.
Documenter.Utilities.srcpath
— Method.Find the path of a file relative to the source
directory. root
is the path to the directory containing the file file
.
It is meant to be used with walkdir(source)
.
Documenter.Utilities.submodules
— Method.Returns the set of submodules of a given root module/s.
Documenter.Utilities.withoutput
— Method.Call a function and capture all stdout
and stderr
output.
withoutput(f) --> (result, success, backtrace, output)
where
result
is the value returned from calling functionf
.success
signals whetherf
has thrown an error, in which caseresult
stores theException
that was raised.backtrace
aVector{Ptr{Cvoid}}
produced bycatch_backtrace()
if an error is thrown.output
is the combined output ofstdout
andstderr
during execution off
.