scribble-code-examples
source code: https://github.com/AlexKnauth/scribble-code-examples
(require scribble-code-examples) | |
package: scribble-code-examples-lib |
procedure
(code-examples #:lang language #:context context [ #:inset? inset? #:show-lang-line show-lang-line #:eval evaluator] examples ...) → block? language : string? context : syntax? inset? : boolean? = #true show-lang-line : (or/c boolean? pre-flow?) = #false evaluator : evaluator? = (make-code-eval #:lang language) examples : string?
@code-examples[#:lang "at-exp racket" #:context #'here]|{ |
(+ 1 2) |
@+[1 3] |
}| |
@code-examples[#:lang "at-exp racket" #:context #'here]|{ |
(require scribble-code-examples (for-label racket/base)) |
@code-examples[#:lang "at-exp racket" #:context #'here]|{ |
(+ 1 2) |
@+[1 3] |
}| |
}| |
>
(require scribble-code-examples (for-label racket/base))
>
@code-examples[#:lang "at-exp racket" #:context #'here]|{ (+ 1 2) @+[1 3] }| (nested-flow (style 'code-inset '()) (list (table (style #f '()) (list (list (table (style #f (list (table-cells (list (list (style #f '(baseline)) (style #f '(baseline)) (style #f '(baseline))))))) (list (list (paragraph (style #f '()) (element 'tt '(">"))) (paragraph (style #f '()) (element 'hspace '(" "))) (table (style "RktBlk" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) (list (list (paragraph (style #f '(omitable)) (list "" (element (style "RktMeta" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "") (element (style "RktPn" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "(") (sized-element (style "RktSym" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) (cached-delayed-element #<procedure:...ibble/racket.rkt:166:18> #<procedure:...ibble/racket.rkt:187:18> #<procedure:...ibble/racket.rkt:188:18> ...) ...) (element (style "RktMeta" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "") (element 'hspace '(" ")) (element (style "RktMeta" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "") (element (style "RktVal" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "1") (element (style "RktMeta" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "") (element 'hspace '(" ")) (element (style "RktMeta" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "") (element (style "RktVal" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "2") (element (style "RktPn" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) ")") (element (style "RktMeta" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "")))))))))) (list (paragraph (style #f '()) (element (style "RktRes" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "3"))) (list (table (style #f (list (table-cells (list (list (style #f '(baseline)) (style #f '(baseline)) (style #f '(baseline))))))) (list (list (paragraph (style #f '()) (element 'tt '(">"))) (paragraph (style #f '()) (element 'hspace '(" "))) (table (style "RktBlk" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) (list (list (paragraph (style #f '(omitable)) (list "" (element (style "RktMeta" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "") (element (style "RktPn" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "@") (sized-element (style "RktSym" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) (cached-delayed-element #<procedure:...ibble/racket.rkt:166:18> #<procedure:...ibble/racket.rkt:187:18> #<procedure:...ibble/racket.rkt:188:18> ...) ...) (element (style "RktPn" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "[") (element (style "RktVal" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "1") (element (style "RktMeta" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "") (element 'hspace '(" ")) (element (style "RktMeta" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "") (element (style "RktVal" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "3") (element (style "RktPn" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "]") (element (style "RktMeta" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "")))))))))) (list (paragraph (style #f '()) (element (style "RktRes" (list 'tt-chars (css-addition '(collects #"scribble" #"racket.css")) (tex-addition '(collects #"scribble" #"racket.tex")))) "4")))))))
procedure
(make-code-eval #:lang language) → evaluator?
language : string?
>
(require scribble-code-examples)
>
(define ev (make-code-eval #:lang "racket"))
>
(ev '(+ 1 2)) 3
>
(ev "(+ 1 2)") 3