Render italic and bold in Markdown.
Scribble => Markdown @bold{text} **text** @italic{text} _text_ original commit: 00a5bf63b1819f324ea41b91ce8ee288e1dc7ff5
This commit is contained in:
parent
cdc89f9685
commit
98e3fa52d8
|
@ -176,14 +176,13 @@
|
|||
(if (target-url? p) p #f)))
|
||||
(define url (and targ (target-url-addr targ)))
|
||||
(begin0
|
||||
(cond [url
|
||||
(define new-i
|
||||
(match (element-content i)
|
||||
[(list (? string? s))
|
||||
(element (element-style i)
|
||||
(list (format "[~a](~a)" s url)))]
|
||||
[else i]))
|
||||
(super render-content new-i part ri)]
|
||||
(cond [url (define new-i
|
||||
(match (element-content i)
|
||||
[(list (? string? s))
|
||||
(element (element-style i)
|
||||
(list (format "[~a](~a)" s url)))]
|
||||
[else i]))
|
||||
(super render-content new-i part ri)]
|
||||
[(and (element? i)
|
||||
(let ([s (element-style i)])
|
||||
(or (eq? 'hspace s)
|
||||
|
@ -191,8 +190,15 @@
|
|||
(eq? 'hspace (style-name s))))))
|
||||
(parameterize ([current-preserve-spaces #t])
|
||||
(super render-content i part ri))]
|
||||
[else
|
||||
(super render-content i part ri)])
|
||||
[else (define style (and (element? i) (element-style i)))
|
||||
(define bold? (eq? style 'bold))
|
||||
(define italic? (eq? style 'italic))
|
||||
(cond [bold? (display "**")]
|
||||
[italic? (display "_")])
|
||||
(begin0
|
||||
(super render-content i part ri)
|
||||
(cond [bold? (display "**")]
|
||||
[italic? (display "_")]))])
|
||||
(when tick?
|
||||
(phrase-ticks-depth (sub1 (phrase-ticks-depth)))
|
||||
(when (zero? (phrase-ticks-depth))
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
[I am a hyperlink to Racket.](http://www.racket-lang.org/)
|
||||
|
||||
Italic. \_Just underlines\_.
|
||||
_Italic_. \_Just underlines\_.
|
||||
|
||||
Bold. \*Just asterisks.\*
|
||||
**Bold**. \*Just asterisks.\*
|
||||
|
||||
“Dobule quoted”. ‘Single quoted’.
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user