Book and Quill

Books and quills are items used to write written books.

Writing
By pressing or long pressing screen anywhere while holding a book and quill in their hand, the player can open a text editor GUI.

Using this GUI, the player can write a single book up to 50 pages long, with up to 255 characters per page, with line breaks counting as two characters. The player can write up to 12,800 characters inside the entire book. No page may be longer than 14 lines and each line can have an average of 19 characters, determined by the width of the used characters.

The player has the ability to copy and paste into books. However, the paste will not work if the text being pasted is longer than a single page. Most Unicode characters are available in books, and they may be pasted in without issue.

In Singleplayer, the world will pause while a book is being edited.

The cursor cannot be moved while writing into a book. Selecting text is also unavailable.

Formatting codes
Text in a book can be styled using codes starting with the character (section sign), which may be copied and pasted into the book or typed using varying methods based on your keyboard.
 * + creates randomly changing characters.
 * + creates bold text.
 * + creates text with a strike-through.
 * + creates underlined text.
 * + creates italic text.
 * + –  (hexadecimal) creates colored text. (When the color is changed, formatting codes are reset)
 * + resets any of the previous styles so text after it appears normally.

To use multiple formatting codes, the color code must be used first, as it will cancel out all preceding codes. If you use multiple codes, and continue typing past the end of a line, the next line will exhibit only the last formatting code used.

Signing
Books can be signed by pressing the "Sign" button while in the interface. When signed, a book will have the name of the player who wrote it and a title chosen upon signing. After it has been signed, it cannot be edited again – it has turned into a written book.

The title of the book can be up to 16 characters long, and the player cannot paste into a title. Special characters can be used in the title, if typed from a keyboard which contains them. Alt codes do not work, and the character cannot be typed even using a keyboard which has it implemented, meaning titles cannot be colored or formatted in-game. However, on Linux using the compose key to produce special characters does work.

Trading
Expert-level librarian villagers buy a book and quill for one emerald.

Data values
Book and quill items have a data value of 386, and the ID name. They use their item data to determine the contents of the book.

Item data

 * : The item
 * : The tag tag.
 * : The list of pages in the book.
 * A single page in the book. If generated in-game, each page is a string in double quotes and uses the escape sequences \" for a double quote, \n for a line break and \\ for a backslash. If created by commands or external tools, a page can be a serialized JSON object or an array of strings and/or objects (see Commands) or an unescaped string.

Trivia

 * The in-game restrictions on books are not hard limits. Third party editors or commands can make books have more than 50 pages (2,147,483,639 pages), more than 256 characters per page (32,767 characters per page), can change author names, and can have colored titles, among other things. These books will still function properly in vanilla Minecraft, meaning you may encounter such books on adventure maps or multiplayer servers.
 * Although the name blank is only 16 characters long, you can give it a longer name using an anvil.
 * If you rename a book and quill in an anvil before signing it, it will keep the name from the anvil instead of taking the name from signing.
 * If you rename a book and quill in an anvil before writing in it, you will not be capable of writing anything in the book. If something is written in it before it is renamed, then it will function normally.