From 94fa0a30d2e2fb65a685f557a59200386738832d Mon Sep 17 00:00:00 2001 From: Laurent Orseau Date: Tue, 29 Oct 2013 09:00:35 +0100 Subject: [PATCH] Scribble->Markdown titles are now rendered correctly. Sections have been shifted by one level (which also looks better on Github). Markdown: fix defmodule to avoid printing the package in the example fix markdown example file to make test pass original commit: fc3321481ce9928eaeea393302a0c0f187937271 --- .../scribble-lib/scribble/markdown-render.rkt | 4 +--- .../scribble-test/tests/scribble/markdown-docs/example.md | 8 +++++--- .../tests/scribble/markdown-docs/example.scrbl | 4 +++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pkgs/scribble-pkgs/scribble-lib/scribble/markdown-render.rkt b/pkgs/scribble-pkgs/scribble-lib/scribble/markdown-render.rkt index c271588f..2772d45d 100644 --- a/pkgs/scribble-pkgs/scribble-lib/scribble/markdown-render.rkt +++ b/pkgs/scribble-pkgs/scribble-lib/scribble/markdown-render.rkt @@ -44,9 +44,7 @@ (define/override (render-part d ht) (let ([number (collected-info-number (part-collected-info d ht))]) (unless (part-style? d 'hidden) - (unless (zero? (number-depth number)) - (printf (make-string (number-depth number) #\#)) - (printf " ")) + (printf (string-append (make-string (add1 (number-depth number)) #\#) " ")) (let ([s (format-number number '())]) (unless (null? s) (printf "~a.~a" diff --git a/pkgs/scribble-pkgs/scribble-test/tests/scribble/markdown-docs/example.md b/pkgs/scribble-pkgs/scribble-test/tests/scribble/markdown-docs/example.md index dfe51ff0..4bd54886 100644 --- a/pkgs/scribble-pkgs/scribble-test/tests/scribble/markdown-docs/example.md +++ b/pkgs/scribble-pkgs/scribble-test/tests/scribble/markdown-docs/example.md @@ -1,12 +1,14 @@ -# 1. Section +# Title + +## 1. Section This is a top-level section. -## 1.1. Subsection +### 1.1. Subsection This is a subsection. -### 1.1.1. Subsubsection +#### 1.1.1. Subsubsection This is a subsubsection. diff --git a/pkgs/scribble-pkgs/scribble-test/tests/scribble/markdown-docs/example.scrbl b/pkgs/scribble-pkgs/scribble-test/tests/scribble/markdown-docs/example.scrbl index 17416f4d..493ad6a9 100644 --- a/pkgs/scribble-pkgs/scribble-test/tests/scribble/markdown-docs/example.scrbl +++ b/pkgs/scribble-pkgs/scribble-test/tests/scribble/markdown-docs/example.scrbl @@ -5,6 +5,8 @@ @(define my-eval (make-base-eval)) @(my-eval '(require racket/base)) +@title{Title} + @section{Section} This is a top-level section. @@ -66,7 +68,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Example of a defmodule: -@defmodule[racket/string] +@defmodule[racket/string #:packages ()] Example of a defproc: