diff --git a/collects/scribble/markdown-render.rkt b/collects/scribble/markdown-render.rkt index bfaf1506..020fd9c4 100644 --- a/collects/scribble/markdown-render.rkt +++ b/collects/scribble/markdown-render.rkt @@ -39,8 +39,9 @@ (define/override (render-part d ht) (let ([number (collected-info-number (part-collected-info d ht))]) - (printf (make-string (add1 (length number)) #\#)) - (printf " ") + (unless (zero? (length number)) + (printf (make-string (length number) #\#)) + (printf " ")) (for ([n (in-list (reverse number))] #:when n) (printf "~s." n)) (when (part-title-content d) (when (ormap values number) (printf " ")) diff --git a/collects/tests/scribble/markdown-docs/example.md b/collects/tests/scribble/markdown-docs/example.md index c5851792..b9852ecf 100644 --- a/collects/tests/scribble/markdown-docs/example.md +++ b/collects/tests/scribble/markdown-docs/example.md @@ -1,12 +1,22 @@ -# ```scheme - (require racket/string) -``` +# 1. Section + +This is a top-level section. + +## 1.1. Subsection + +This is a subsection. + +### 1.1.1. Subsubsection + +This is a subsubsection. + +Here is an itemize: * Item 1. * Item 2. -## 1. Section +Here is a hyperlink: [I am a hyperlink to Racket.](http://www.racket-lang.org/) @@ -16,12 +26,14 @@ _Italic_. \_Just underlines\_. “Dobule quoted”. ‘Single quoted’. +Example of vebatim: + `Hi, world.` `A “quote”.` `Second line.` `Last line.` -The end. +Another example of verbatim, with ticks/quotes: `THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS` `“AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT` @@ -35,6 +47,14 @@ The end. `(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE` `OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.` +Example of a defmodule: + +```scheme + (require racket/string) +``` + +Example of a defproc: + ```scheme (make-string k [char]) -> string? k : exact-nonnegative-integer? diff --git a/collects/tests/scribble/markdown-docs/example.scrbl b/collects/tests/scribble/markdown-docs/example.scrbl index 6776e22c..0b839666 100644 --- a/collects/tests/scribble/markdown-docs/example.scrbl +++ b/collects/tests/scribble/markdown-docs/example.scrbl @@ -3,14 +3,26 @@ @(require scribble/manual (for-label racket/base racket/contract racket/string)) -@defmodule[racket/string] +@section{Section} + +This is a top-level section. + +@subsection{Subsection} + +This is a subsection. + +@subsubsection{Subsubsection} + +This is a subsubsection. + +Here is an itemize: @itemize[ @item{Item 1.} @item{Item 2.} ] -@section{Section} +Here is a hyperlink: @hyperlink["http://www.racket-lang.org/" "I am a hyperlink to Racket."] @@ -23,6 +35,8 @@ _Just underlines_. ``Dobule quoted''. `Single quoted'. +Example of vebatim: + @verbatim{ Hi, world. A ``quote''. @@ -30,7 +44,7 @@ Second line. Last line. } -The end. +Another example of verbatim, with ticks/quotes: @verbatim{ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS @@ -46,6 +60,12 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. } +Example of a defmodule: + +@defmodule[racket/string] + +Example of a defproc: + @defproc[(make-string [k exact-nonnegative-integer?][char char? #\nul]) string?]{ Returns a new mutable string of length @racket[k] where each position in the