diff --git a/src/lib/flap_command_line_argument_t.F90 b/src/lib/flap_command_line_argument_t.F90 index 7d1103fa..62621c74 100644 --- a/src/lib/flap_command_line_argument_t.F90 +++ b/src/lib/flap_command_line_argument_t.F90 @@ -290,13 +290,13 @@ function usage(self, pref, markdown) endselect if (trim(adjustl(self%switch))/=trim(adjustl(self%switch_ab))) then if (markdownd) then - usage = new_line('a')//'* `'//trim(adjustl(self%switch))//usage//'`, `'//trim(adjustl(self%switch_ab))//usage//'`' + usage = new_line('a')//'* `'//trim(adjustl(self%switch))//usage//'`, `'//trim(adjustl(self%switch_ab))//usage//'` ' else usage = ' '//switch_//usage//', '//switch_ab_//usage endif else if (markdownd) then - usage = new_line('a')//'* `'//trim(adjustl(self%switch))//usage//'`' + usage = new_line('a')//'* `'//trim(adjustl(self%switch))//usage//'` ' else usage = ' '//switch_//usage endif @@ -304,20 +304,24 @@ function usage(self, pref, markdown) else if (trim(adjustl(self%switch))/=trim(adjustl(self%switch_ab))) then if (markdownd) then - usage = new_line('a')//'* `'//trim(adjustl(self%switch))//' value`, `'//trim(adjustl(self%switch_ab))//' value'//'`' + usage = new_line('a')//'* `'//trim(adjustl(self%switch))//' value`, `'//trim(adjustl(self%switch_ab))//' value'//'` ' else usage = ' '//switch_//' value, '//switch_ab_//' value' endif else if (markdownd) then - usage = new_line('a')//'* `'//trim(adjustl(self%switch))//' value`' + usage = new_line('a')//'* `'//trim(adjustl(self%switch))//' value` ' else usage = ' '//switch_//' value' endif endif endif else - usage = ' value' + if (markdownd) then + usage = new_line('a')//'* value' + else + usage = ' value' + endif endif if (allocated(self%choices)) then usage = usage//', value in: `'//self%choices//'`' @@ -330,13 +334,13 @@ function usage(self, pref, markdown) else if (trim(adjustl(self%switch))/=trim(adjustl(self%switch_ab))) then if (markdownd) then - usage = new_line('a')//'* `'//trim(adjustl(self%switch))//'`, `'//trim(adjustl(self%switch_ab))//'`' + usage = new_line('a')//'* `'//trim(adjustl(self%switch))//'`, `'//trim(adjustl(self%switch_ab))//'` ' else usage = ' '//switch_//', '//switch_ab_ endif else if (markdownd) then - usage = new_line('a')//'* `'//trim(adjustl(self%switch))//'`' + usage = new_line('a')//'* `'//trim(adjustl(self%switch))//'` ' else usage = ' '//switch_ endif @@ -344,8 +348,14 @@ function usage(self, pref, markdown) endif prefd = '' ; if (present(pref)) prefd = pref usage = prefd//usage - if (self%is_positional) usage = usage//new_line('a')//prefd//repeat(' ',indent)//trim(str(self%position, .true.))//& - '-th argument' + if (self%is_positional)then + ! two spaces make a line break in markdown. + if (markdownd) then + usage = usage//' ' + endif + usage = usage//new_line('a')//prefd//repeat(' ',4)//trim(str(self%position, .true.))//& + '-th argument' + endif if (allocated(self%envvar)) then if (self%envvar /= '') then usage = usage//new_line('a')//prefd//repeat(' ',10)//'environment variable name "'//trim(adjustl(self%envvar))//'"' @@ -363,9 +373,9 @@ function usage(self, pref, markdown) endif if (self%m_exclude/='') usage = usage//new_line('a')//prefd//repeat(' ', indent)//'mutually exclude "'//self%m_exclude//'"' if (markdownd) then - usage = usage//' '//new_line('a')//prefd//repeat(' ',4)//trim(adjustl(self%help)) + usage = usage//' '//new_line('a')//prefd//repeat(' ',4)//trim(adjustl(self%help))//' ' if (self%help_markdown/='') then - usage = usage//trim(adjustl(self%help_markdown)) + usage = usage//trim(adjustl(self%help_markdown))//' ' endif else usage = usage//new_line('a')//prefd//repeat(' ', indent)//trim(adjustl(self%help)) diff --git a/src/lib/flap_command_line_arguments_group_t.f90 b/src/lib/flap_command_line_arguments_group_t.f90 index 35b5683e..0cd2a95f 100644 --- a/src/lib/flap_command_line_arguments_group_t.f90 +++ b/src/lib/flap_command_line_arguments_group_t.f90 @@ -468,6 +468,7 @@ function usage(self, pref, no_header, markdown) endif if (self%Na_required>0) then usage = usage//new_line('a')//new_line('a')//prefd//'Required switches:' + if(markdownd)usage = usage//' ' do a=1, self%Na if (self%cla(a)%is_required.and.(.not.self%cla(a)%is_hidden)) usage = usage//new_line('a')//& self%cla(a)%usage(pref=prefd,markdown=markdownd) @@ -475,6 +476,7 @@ function usage(self, pref, no_header, markdown) endif if (self%Na_optional>0) then usage = usage//new_line('a')//new_line('a')//prefd//'Optional switches:' + if(markdownd)usage = usage//' ' do a=1, self%Na if (.not.self%cla(a)%is_required.and.(.not.self%cla(a)%is_hidden)) usage = usage//new_line('a')//& self%cla(a)%usage(pref=prefd,markdown=markdownd)