Adding lists to Print-Shanty
Updates to print-shanty.js for 2024-09-23:
SUPPORT FOR LISTS IN PHYSICAL BOOKS
I am adding support for Markdown-type lists to Shanty. If the first character of a line is an asterisk, and the second character is a space (“ ”), then the parser will treat that as an item in a list. At the moment, the syntax for nested lists is backwards. I put it in as an asterisk followed by more spaces to indent an item, when it should be spaces followed by an asterisk.
The next update to Nantucket E-Books will include support for lists.
This could also be used to include ragged-right paragraphs.
Allowing spaces at the start of lines meant that lines weren’t getting trimmed properly, which prevented the text from justifying in some areas. I believe I have fixed that bug.
BETTER INDENTATIONS
I made the mistake of allowing spaces to be used as indentations in the text. This does not work with proportionally-spaced fonts, since the the spaces themselves can vary in width. Instead, you need to set the x-position of for the start of the <text> SVG element. This is already how indentations for new paragraphs worked, but I had not been consistent in implementing it that way.
Another issue I’ve had is that bold text in the table of contents is ever-so-slightly misaligned from other items in the list. I’ve introduced an offset value that realigns the bold text.
SHOW/HIDE COMMENTS
WANT TO COMMENT?
SEND AN E-MAIL TO NJB@NANTUCKETEBOOKS.COM WITH THIS SUBJECT LINE: