-
Notifications
You must be signed in to change notification settings - Fork 96
/
A-Non-Post-Scribble-Page.scrbl
106 lines (84 loc) · 2.69 KB
/
A-Non-Post-Scribble-Page.scrbl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#lang scribble/manual
@; This is a Scribble comment.
@; If you want links to online docs, `require` the module(s) using
@; `for-label`:
@(require (for-label racket))
@title{Example of Non-Post Scribble Page. And a λ char.}
This is an example of a non-post page written in Scribble.
Here's some @hyperlink["http://bullshitipsum.com/?paragraphs=2"
"Bullshit Ipsum"].
Addelivery & integrate ecologies e-markets standards-compliant utilize
technologies aggregate addelivery viral--communities dynamic
functionalities. Mindshare engineer viral A-list: cross-platform remix
engage social cross-media social innovate distributed matrix
experiences monetize utilize innovative. Action-items transition
recontextualize sexy Cluetrain envisioneer, "vortals communities
evolve technologies sexy methodologies." Enhance grow compelling
iterate architect matrix plug-and-play reinvent scale, distributed
incentivize, extend.
@section[#:style 'unnumbered]{A Section}
I am some text.
@subsection[#:style 'unnumbered]{A SubSection}
A @racket[codeblock] uses curly braces and @emph{does} retain
comments:
@codeblock{
;; Finds Racket sources in all subdirs
(for ([path (in-directory)])
(when (regexp-match? #rx"[.]rkt$" path)
(printf "source file: ~a\n" path)))
(define (foo #:bar bar)
#t)
}
A @racket[racketblock] uses square brackets and does @emph{not}
retain comments:
@racketblock[
;; Finds Racket sources in all subdirs
(for ([path (in-directory)])
(when (regexp-match? #rx"[.]rkt$" path)
(printf "source file: ~a\n" path)))
(define (foo #:bar bar)
#t)
]
Here is a @racket[interaction]:
@(require racket/sandbox
scribble/eval)
@(define my-tr-evaluator
(parameterize ([sandbox-output 'string]
[sandbox-error-output 'string])
(make-evaluator 'typed/racket/base)))
@interaction[#:eval my-tr-evaluator
(: my-sqr (Real -> Real))
(define (my-sqr x)
(* x x))
(my-sqr 42)]
Here's a fancier one:
@interaction[
(require slideshow/pict)
(define rainbow-colors
'("red" "orange" "yellow" "green" "blue" "purple"))
(for/list ([c rainbow-colors])
(colorize (filled-rounded-rectangle 20 20) c))
(for/list ([c rainbow-colors]
[dir (in-cycle '(right left))])
(standard-fish 25 25 #:color c #:direction dir))
(cc-superimpose
(cc-superimpose (cloud 100 80 "lightblue")
(cloud 90 70 "white"))
(hc-append 10
(standard-fish 30 30 #:color "red" #:direction 'right)
(standard-fish 25 20 #:color "blue" #:direction 'left)))
]
How about non-Racket code? You can ask Pygments to syntax highlight it
for you, like so:
@(require frog/scribble)
@pygment-code[#:lang "js"]{
/**
* Some JavaScript
*/
function foo()
{
if (counter <= 10)
return;
// it works!
}
}