Debian Codegraph @

README.rst

raw
1 Formiko
2 =======
3
4 :author: Ondřej Tůma <[email protected]>
5 :contributors: `The Formiko Team <https://github.com/ondratu/formiko/blob/master/formiko/data/AUTHORS>`_
6
7 Formiko is a reStructuredText and MarkDown editor and live previewer. It is
8 written in Python with Gtk4, GtkSourceView and WebKit. It uses Docutils and a
9 MarkDown-to-reStructuredText converter. If you want to **donate** to the
10 development, you can do so via the `paypal link <https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=4F4EJ3SV8JGYJ&item_name=Formiko+editor&currency_code=EUR&amount=5&source=url>`_.
11
12 Features:
13 ---------
14 * GtkSourceView based editor with syntax highlighting
15 * optional Vim editor support
16 * vertical or horizontal window splitting
17 * preview mode with auto scroll
18 * periodic save file
19 * json and html preview
20 * spell check
21 * linked file opening
22
23 It supports these parsers and writers:
24
25 * Docutils reStructuredText parser - https://www.docutils.org
26 * MarkDown to reStructuredText convertor (M2R2) -
27 https://github.com/crossnox/m2r2
28 * Docutils HTML4, HTML5, S5/HTML slide show and PEP HTML writer -
29 http://docutils.sourceforge.net
30 * Tiny HTML writer - https://github.com/ondratu/docutils-tinyhtmlwriter
31
32 Custom directives
33 ~~~~~~~~~~~~~~~~~
34 Formiko registers additional directives that are available in both
35 reStructuredText and MarkDown (via M2R2) documents.
36
37 ``.. file-tree:: <path>``
38 Renders a directory tree rooted at *path* (relative to the source file)
39 as a bullet list.
40
41 Options:
42
43 ``:depth: <n>``
44 Maximum display depth. Default is ``2``.
45 ``:include: <pattern>``
46 Show only files matching the glob pattern (e.g. ``*.md``).
47 Directories with no matching files are hidden automatically.
48 ``:exclude: <pattern>``
49 Hide files matching the glob pattern. Applied after ``:include:``.
50 ``:links:``
51 Turn file names into hyperlinks pointing to the files,
52 with paths relative to the source document.
53
54 Example::
55
56 .. file-tree:: docs
57 :depth: 3
58 :include: *.rst
59 :links:
60
61 ``.. mdinclude:: <file>``
62 Includes a Markdown file and converts it to reStructuredText inline.
63 Requires `m2r2 <https://github.com/crossnox/m2r2>`_. The directive is
64 intended for Markdown files, but works in RST documents as well.
65
66 Options:
67
68 ``:start-line: <n>``
69 Start reading the file from line *n*.
70 ``:end-line: <n>``
71 Stop reading the file at line *n*.
72
73 Example::
74
75 .. mdinclude:: CONTRIBUTING.md
76 :start-line: 3
77
78 Vim support
79 ~~~~~~~~~~~
80 Formiko has Neovim editor support aka ``formiko-vim`` command. This runs `Neovim
81 <https://neovim.io/>`_ editor in Vte.Terminal.
82
83 Requirements:
84 -------------
85 * Python 3
86 * GTK 4
87 * gobject-introspection
88 * PyGObject
89 * WebKitGTK 6.x
90 * GtkSourceView 5.x
91 * libspelling 1.x
92 * gir files for all Gtk libraries
93 * vte - neovim support
94 * docutils - reStructuredText support
95 * jsonpath-ng - JSON Search path support
96
97 recommended:
98 ~~~~~~~~~~~~
99 * m2r2 - converting MarkDown to reStructuredText
100 * Pygments - syntax color in html output code blocks
101 * docutils-tinyhtmlwriter - Tiny HTML Writer
102
103 **formiko-vim**:
104
105 * vte - Terminal emulator widget
106 * neovim - heavily refactored vim fork
107 * pynvim - Python3 library for scripting Neovim processes
108
109 development:
110 ~~~~~~~~~~~~
111
112 * pygobject-stubs
113
114 Installation
115 ------------
116
117 Flatpak
118 ~~~~~~~
119 Formiko exists in the Flathub repository as cz.zeropage.Formiko. If you are new with
120 Flatpak, see `setup guide <https://flatpak.org/setup/>`_.
121
122 .. code:: sh
123
124 # add Flathub repository as root
125 flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
126
127 # install Formiko as user
128 flatpak install flathub cz.zeropage.Formiko
129
130 # run Formiko
131 flatpak run cz.zeropage.Formiko
132
133 Debian based
134 ~~~~~~~~~~~~
135 Debian-based distributions sometimes use versions in package names. Here is an
136 example for the Debian Forky version. If you use a different version, your
137 gtksource or webkit2 may have a different version name.
138
139 .. code:: sh
140
141 # python3, gtk4 etc are in dependencies
142 apt install python3-pip python3-gi python3-docutils python3-jsonpath-ng \
143 python3-pygments gir1.2-gtksource-5 gir1.2-webkit-6.0 \
144 gir1.2-spelling-1 gir1.2-adw
145
146 pip3 install formiko --break-system-packages
147
148 # languages
149 apt install hunspell-en-us # or other language you want
150
151 # neovim
152 apt install gir1.2-vte-3.91 neovim python3-pynvim
153
154 NetBSD
155 ~~~~~~
156 **Broken at this moment - the WebKit with GTK4 and the libspelling packages are not available at this moment**
157
158 Installation process can be different for each BSD releases. It's about which
159 Python release is default. By this, you can change ``py313`` to your right
160 version.
161
162 NetBSD use pkgsrc, so some binaries are stored in ``/usr/pkg/bin`` directory.
163 Formiko call neovim directly. If you want to use neovim version with
164 pkgsrc, you must fix ``VIM_PATH`` variable in ``formiko/vim.py`` file.
165
166 .. code:: sh
167
168 # python3.13 is in dependencies, as is gtk4
169 pkgin install py313-pip py313-gobject3 py313-docutils gtksourceview5 \
170 libadwaita librsvg webkit-gtk
171 pip3.6 install jsonpath-ng formiko
172
173 # optionally
174 pkgin install neovim pynvim
175 pip3.6 install m2r2 docutils-tinyhtmlwriter
176
177 FreeBSD
178 ~~~~~~~
179
180 Installation process can be different for each BSD releases. It's about which
181 Python release is default. By this, you can change ``py311`` to your right
182 version.
183
184 On FreeBSD you must install all these packages:
185
186 .. code:: sh
187
188 pkg install py311-pygobject py311-docutils py311-pygments py311-pip \
189 gtksourceview5 webkit2-gtk_60 libspelling py311-jsonpath-ng \
190 libadwaita
191
192 pip-3.11 install formiko
193
194
195
196 **Optionally**
197
198 .. code:: sh
199
200 # MarkDown, and tiny writer support
201 pip-3.11 install m2r2 docutils-tinyhtmlwriter
202
203 # languages
204 pkg install en-hunspell # or other language you want
205
206 # neovim
207 pkg install vte3 neovim py311-pynvim py311-typing-extensions