Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support markdown in help strings #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ version = "1.2.0"

[deps]
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
TextWrap = "b718987f-49a8-5099-9789-dcd902bef87d"

[compat]
Expand Down
2 changes: 1 addition & 1 deletion src/ArgParse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ differences as well.
"""
module ArgParse

import TextWrap
import TextWrap, Markdown

if isdefined(Base, :Experimental) && isdefined(Base.Experimental, Symbol("@compiler_options"))
@eval Base.Experimental.@compiler_options compile=min optimize=0 infer=false
Expand Down
5 changes: 4 additions & 1 deletion src/settings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,10 @@ function add_arg_field!(settings::ArgParseSettings, name::ArgName; desc...)
check_type(required, Bool, "required must be a Bool")
check_type(range_tester, Function, "range_tester must be a Function")
check_type(dest_name, AbstractString, "dest_name must be an AbstractString")
check_type(help, AbstractString, "help must be an AbstractString")
check_type(help, Union{AbstractString,Markdown.MD}, "help must be an AbstractString or Markdown.MD")
if help isa Markdown.MD
help = lstrip(repr("text/plain", help, context=:color=>true))
end
# Check metavar's type to be either an AbstractString or a
# Vector{T<:AbstractString}
metavar_error = "metavar must be an AbstractString or a Vector{<:AbstractString}"
Expand Down
Loading