adjust image layout

main
Matthew Butterick 6 years ago
parent b38209e32e
commit 604041cb6c

@ -1,7 +1,11 @@
#lang quadwriter/markdown
Foo
Here's a jpeg
![alt text](test.jpeg)
Bar
And a png
![alt text](test.png)
Done.

@ -332,7 +332,7 @@
(match-define (list line-width line-height) (quad-size line-q))
(define new-size (let ()
(define line-heights
(filter-map (λ (q) (quad-ref q :line-height (λ () (pt-y (size q))))) pcs))
(filter-map (λ (q) (or (quad-ref q :line-height) (pt-y (size q)))) pcs))
(pt line-width (if (empty? line-heights) line-height (apply max line-heights)))))
(list
(struct-copy

@ -32,9 +32,11 @@
(define-tag-function (img attrs exprs)
(qexpr (list->attrs
:line-height "false"
:line-align-last "center" ; need `last` because img is a block-level element.
:image-data (second (assq 'src attrs))
:image-alt (second (assq 'alt attrs))
:display (symbol->string (gensym))) exprs))
:display "block") exprs))
(define-tag-function (br attrs exprs) line-break)

Loading…
Cancel
Save