chenyanming / shrface

Extend eww/nov with org-mode features, archive web pages to org files with shr.
GNU General Public License v3.0
215 stars 14 forks source link
emacs emacs-lisp package

+TITLE: SHRFACE

+DATE: May 07, 2020

+SINCE: {replace with next tagged release version}

+STARTUP: inlineimages nofold

[[https://melpa.org/#/shrface][file:https://melpa.org/packages/shrface-badge.svg]]

+attr_org: :width 600px

[[file:img/eww.png]]

+BEGIN_QUOTE

The project target is to apply org features and analysis capability to =shr=, and all libraries that render HTML with =shr= (Simple HTML Renderer).

As [[https://www.emacswiki.org/emacs/HtmlRendering][EmacsWiki]] says:

=shr.el= is an HTML renderer in Emacs as of version 24.4 (based on libxml2, it was originally a part of Gnus). It’s the basis of the web browser =eww=.

+END_QUOTE

It's available on [[https://melpa.org/][Melpa]] :

+BEGIN_SRC emacs-lisp

M-x package-install shrface

+END_SRC

This file is my personal configuration for ~shrface~ configured it along with other packages, and I updates it frequently. It can greatly improve your reading experience while also having great performance when using those packages.

You can use it as a reference to configure your own ~shrface~.

** Keybindings Example

+BEGIN_SRC emacs-lisp

(with-eval-after-load 'nov (define-key nov-mode-map (kbd "") 'shrface-outline-cycle) (define-key nov-mode-map (kbd "S-") 'shrface-outline-cycle-buffer) (define-key nov-mode-map (kbd "C-t") 'shrface-toggle-bullets) (define-key nov-mode-map (kbd "C-j") 'shrface-next-headline) (define-key nov-mode-map (kbd "C-k") 'shrface-previous-headline) (define-key nov-mode-map (kbd "M-l") 'shrface-links-counsel) ; or 'shrface-links-helm or 'shrface-links-consult (define-key nov-mode-map (kbd "M-h") 'shrface-headline-counsel)) ; or 'shrface-headline-helm or 'shrface-headline-consult

(with-eval-after-load 'eww (define-key eww-mode-map (kbd "") 'shrface-outline-cycle) (define-key eww-mode-map (kbd "S-") 'shrface-outline-cycle-buffer) (define-key eww-mode-map (kbd "C-t") 'shrface-toggle-bullets) (define-key eww-mode-map (kbd "C-j") 'shrface-next-headline) (define-key eww-mode-map (kbd "C-k") 'shrface-previous-headline) (define-key eww-mode-map (kbd "M-l") 'shrface-links-counsel) ; or 'shrface-links-helm or 'shrface-links-consult (define-key eww-mode-map (kbd "M-h") 'shrface-headline-counsel)) ; or 'shrface-headline-helm or 'shrface-headline-consult

(with-eval-after-load 'mu4e (define-key mu4e-view-mode-map (kbd "") 'shrface-outline-cycle) (define-key mu4e-view-mode-map (kbd "S-") 'shrface-outline-cycle-buffer) (define-key mu4e-view-mode-map (kbd "C-t") 'shrface-toggle-bullets) (define-key mu4e-view-mode-map (kbd "C-j") 'shrface-next-headline) (define-key mu4e-view-mode-map (kbd "C-k") 'shrface-previous-headline) (define-key mu4e-view-mode-map (kbd "M-l") 'shrface-links-counsel) ; or 'shrface-links-helm or 'shrface-links-consult (define-key mu4e-view-mode-map (kbd "M-h") 'shrface-headline-counsel)) ; or 'shrface-headline-helm or 'shrface-headline-consult

;; my personaly keybindings (Doom Eamcs) (map! :map nov-mode-map :after nov :g "" 'shrface-outline-cycle ;; redundant, just make sure it works :nie "TAB" 'shrface-outline-cycle ;; redundant, just make sure it works :nie "S-" 'shrface-outline-cycle-buffer ;; redundant, just make sure it works :g [backtab] 'shrface-outline-cycle-buffer ;; redundant, just make sure it works :nie "" 'shrface-outline-cycle-buffer ;; redundant, just make sure it works :nie "C-j" 'shrface-next-headline :nie "C-k" 'shrface-previous-headline)

+END_SRC