An open API service indexing awesome lists of open source software.

https://github.com/jumper047/fb2-reader

Emacs plugin to read .fb2 and .fb2.zip ebooks.
https://github.com/jumper047/fb2-reader

emacs fb2

Last synced: about 1 year ago
JSON representation

Emacs plugin to read .fb2 and .fb2.zip ebooks.

Awesome Lists containing this project

README

          

#+TITLE: FB2-reader
#+html:
#+PROPERTY: LOGGING nil
[[https://melpa.org/#/fb2-reader][file:https://melpa.org/packages/fb2-reader-badge.svg]]

Plugin for Emacs to read FictionBook2 ebooks.

*Features:*

- read .fb2 and .fb2.zip files
- reach book formatting
- showing current title in header line
- internal links (select from keyboard, jump back and forth)
- navigation (next/previous chapters, imenu support)
- restoring last read position
- displaying raw xml
- book info screen
- table of content in separate buffer

*Coming soon:*

- integration with https://github.com/jumper047/librera-sync
- rendering book in org-mode

* Screenshots

*Main window*

[[./images/main_window.png]]

*Header line*

[[./images/headerline.gif]]

*Metadata screen*

[[./images/metadata.png]]

*Book loading screen*

[[./images/splash_screen.png]]

*Outline*

[[./images/outline.png]]

* TL;DR
Add to your config and open any .fb2 or .fb2.zip document.
#+begin_src emacs-lisp
(use-package fb2-reader
:mode ("\\.fb2\\(\\.zip\\)?\\'" . fb2-reader-mode)
:commands (fb2-reader-continue)
:custom
;; This mode renders book with fixed width, adjust to your preferences.
(fb2-reader-page-width 120)
(fb2-reader-image-max-width 400)
(fb2-reader-image-max-height 400))
#+end_src

* Installation

Install =fb2-reader= from MELPA and add that string to your config:
#+begin_src emacs-lisp
(require 'fb2-reader)
#+end_src

Also you can set it up with use-package:
#+begin_src emacs-lisp
(use-package fb2-reader
:commands (fb2-reader-continue))
#+end_src

* Customization
Every book rendered as buffer with certain width, so you may want to tune variables related to your monitor's size or reading preferences:
- *fb2-reader-page-width* - width of rendered book
- *fb2-reader-image-max-width* and *fb2-reader-image-max-height* - max. width and height of an images in book.

You can view all available options with =M-x customize-group fb2-reader=.

* Usage
Just open an .fb2 or .fb2.zip file.
First opening will take a time - book will be rendered and saved to cache, so all next ones will be quick.
You can continue reading by executing =M-x fb2-reader-continue=.
Key bindings listed below:

*Fb2-reader:*
|----------+-----------------------------------------|
| Key | Action |
|----------+-----------------------------------------|
| =[=, =]= | Jump to previous or next chapter |
|----------+-----------------------------------------|
| =p=, =n= | Jump to previous or next displayed link |
|----------+-----------------------------------------|
| =l=, =B= | Jump to last used link's location |
|----------+-----------------------------------------|
| =B=, =N= | Jump to last used link's target |
|----------+-----------------------------------------|
| =g= | Reload current book |
|----------+-----------------------------------------|
| =v= | View current book as xml |
|----------+-----------------------------------------|
| =x= | Reopen fb2.zip document as archive |
|----------+-----------------------------------------|
| =i= | View FB2 metadata |
|----------+-----------------------------------------|
| =j= | Jump to chapter via imenu |
|----------+-----------------------------------------|
| =o=, =t= | Show TOC outline |
|----------+-----------------------------------------|
| =c= | Toggle no-cursor mode |
|----------+-----------------------------------------|
*Metadata:*
|----------+------------------------------------|
| Key | Action |
|----------+------------------------------------|
| =p=, =n= | Jump to previous or next field |
|----------+------------------------------------|
| =P=, =N= | Jumps to previous or next category |
|----------+------------------------------------|
| =c= | Toggle no-cursor mode |
|----------+------------------------------------|
| =q= | Quit window |
|----------+------------------------------------|
*Outline:*
|----------------+-------------------------------------------------|
| Key | Action |
|----------------+-------------------------------------------------|
| =p=, =n= | Jump to previous or next heading |
|----------------+-------------------------------------------------|
| =RET= | Follow link |
|----------------+-------------------------------------------------|
| =C-o=, =SPACE= | Display link (withoiut switching to fb2 buffer) |
|----------------+-------------------------------------------------|
| =M-RET= | Follow link and quit TOC window |
|----------------+-------------------------------------------------|
| =o=, =t= | Switch to fb2 window |
|----------------+-------------------------------------------------|
| =q= | Quit TOC window |
|----------------+-------------------------------------------------|
| =Q= | Kill TOC window |
|----------------+-------------------------------------------------|

* Aknowledgements
Heavily inspired by [[https://github.com/spline1986][@spline1986's]] [[https://github.com/spline1986/fb2-mode][fb2-mode]].
Also kudos for [[https://github.com/vlichevsky][@vlichevsky]] - his testing is extremely helpful!