Giter Site home page Giter Site logo

formiko's People

Contributors

benburrill avatar fr-dae avatar jbicha avatar ondratu avatar palob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

formiko's Issues

Folder support

Idea: I think it can be interesting to add an optional current folder column on the left so we can use formiko to choose notes fastly.

"reload from storage" pops up during editing

from time to time I get messages "reload from storage" during editing with formiko without any reason. I generally said yes, but it is quite disturbing when a window pops up during entering characters at the keyboard.

I am using formiko 1.4.3 from flathub under EndlessOS 5.05

Math module

Hi,

I'm using formiko (downloaded it today) and apparently it does not compile math formulas:

Power, current and voltage vectors
""""""""""""""""""""""""""""""""""
.. math::
	[demand\_power ]= [C_{load,bus}]^\top \cdot [load\_power\_S]

The error that appears in the preview panel is this:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/formiko/renderer.py", line 267, in render_output
    html = publish_string(**kwargs).decode('utf-8')
  File "/usr/lib/python3/dist-packages/docutils/core.py", line 416, in publish_string
    enable_exit_status=enable_exit_status)
  File "/usr/lib/python3/dist-packages/docutils/core.py", line 664, in publish_programmatically
    output = pub.publish(enable_exit_status=enable_exit_status)
  File "/usr/lib/python3/dist-packages/docutils/core.py", line 219, in publish
    output = self.writer.write(self.document, self.destination)
  File "/usr/lib/python3/dist-packages/docutils/writers/__init__.py", line 80, in write
    self.translate()
  File "/usr/local/lib/python3.6/dist-packages/docutils_html5/__init__.py", line 106, in translate
    self.document.walkabout(visitor)
  File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 174, in walkabout
    if child.walkabout(visitor):
  File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 174, in walkabout
    if child.walkabout(visitor):
  File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 174, in walkabout
    if child.walkabout(visitor):
  [Previous line repeated 1 more time]
  File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 166, in walkabout
    visitor.dispatch_visit(self)
  File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 1882, in dispatch_visit
    return method(node)
  File "/usr/local/lib/python3.6/dist-packages/docutils_html5/__init__.py", line 564, in unknown_visit
    simple_element = self.simple_elements[node.__class__.__name__]
KeyError: 'math_block'

Question regarding code blocks

Hello, I've tried something like this:

.. code-block:: python
   :linenos:

... which complains like this:

System Message: ERROR/3 (<string>, line 11)
Error in "code-block" directive: maximum 1 argument(s) allowed, 2 supplied.

Am I missing something?
By the way... it's Formiko 1.3.0 on Debian Buster. More info below:

$ uname -a
Linux lua 4.18.0-1-amd64 #1 SMP Debian 4.18.6-1 (2018-09-06) x86_64 GNU/Linux

$ cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux buster/sid"
NAME="Debian GNU/Linux"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

$ sudo apt install formiko -y 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  gir1.2-gtkspell3-3.0 gir1.2-javascriptcoregtk-4.0 gir1.2-webkit2-4.0 libgtkspell3-3-0 python3-commonmark-bkrs python3-recommonmark
Suggested packages:
  vim-gtk3 python-commonmark-bkrs-doc
The following NEW packages will be installed:
  formiko gir1.2-gtkspell3-3.0 gir1.2-javascriptcoregtk-4.0 gir1.2-webkit2-4.0 libgtkspell3-3-0 python3-commonmark-bkrs python3-recommonmark
0 upgraded, 7 newly installed, 0 to remove and 10 not upgraded.
Need to get 0 B/372 kB of archives.
After this operation, 1,360 kB of additional disk space will be used.
Selecting previously unselected package libgtkspell3-3-0:amd64.
(Reading database ... 235960 files and directories currently installed.)
Preparing to unpack .../0-libgtkspell3-3-0_3.0.9-2_amd64.deb ...
Unpacking libgtkspell3-3-0:amd64 (3.0.9-2) ...
Selecting previously unselected package gir1.2-gtkspell3-3.0:amd64.
Preparing to unpack .../1-gir1.2-gtkspell3-3.0_3.0.9-2_amd64.deb ...
Unpacking gir1.2-gtkspell3-3.0:amd64 (3.0.9-2) ...
Selecting previously unselected package gir1.2-javascriptcoregtk-4.0:amd64.
Preparing to unpack .../2-gir1.2-javascriptcoregtk-4.0_2.22.0-2_amd64.deb ...
Unpacking gir1.2-javascriptcoregtk-4.0:amd64 (2.22.0-2) ...
Selecting previously unselected package gir1.2-webkit2-4.0:amd64.
Preparing to unpack .../3-gir1.2-webkit2-4.0_2.22.0-2_amd64.deb ...
Unpacking gir1.2-webkit2-4.0:amd64 (2.22.0-2) ...
Selecting previously unselected package python3-commonmark-bkrs.
Preparing to unpack .../4-python3-commonmark-bkrs_0.5.4+ds-1_all.deb ...
Unpacking python3-commonmark-bkrs (0.5.4+ds-1) ...
Selecting previously unselected package python3-recommonmark.
Preparing to unpack .../5-python3-recommonmark_0.4.0+ds-2_all.deb ...
Unpacking python3-recommonmark (0.4.0+ds-2) ...
Selecting previously unselected package formiko.
Preparing to unpack .../6-formiko_1.3.0-1_all.deb ...
Unpacking formiko (1.3.0-1) ...
Processing triggers for mime-support (3.61) ...
Processing triggers for desktop-file-utils (0.23-3) ...
Setting up python3-commonmark-bkrs (0.5.4+ds-1) ...
Setting up gir1.2-javascriptcoregtk-4.0:amd64 (2.22.0-2) ...
Processing triggers for libc-bin (2.27-6) ...
Setting up python3-recommonmark (0.4.0+ds-2) ...
Setting up libgtkspell3-3-0:amd64 (3.0.9-2) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Setting up gir1.2-webkit2-4.0:amd64 (2.22.0-2) ...
Setting up gir1.2-gtkspell3-3.0:amd64 (3.0.9-2) ...
Setting up formiko (1.3.0-1) ...
Processing triggers for libc-bin (2.27-6) ...
Scanning processes...
Scanning processor microcode...
Scanning linux images...
Running kernel seems to be up-to-date.
The processor microcode seems to be up-to-date.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.

Thanks

Search text panel

Search functionality (Ctrl-F) in editor panel, and in Preview panel.

[BUG]pip3 install ERROR

on Lubuntu24.04

dae@dae-gl753vd:~/Script/git-lfs-3.4.1$ pip3 install formiko
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.
    
    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.
    
    See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

Changes to "tab_width" in the .ini file are ignored and reverted.

Hi,

I've been looking for an editor for reST files and am very impressed with Formiko. Great editor! Running version 1.4.3 from Flathub on Ubuntu 18.04.

To reproduce:

  1. Edit file ~/.var/app/cz.zeropage.Formiko/config/formiko.ini by changing
  spaces_instead_of_tabs = False
  tab_width = 2

to

  spaces_instead_of_tabs = True
  tab_width = 4
  1. Run with flatpak run cz.zeropage.Formiko
  2. Enter a tab in the editor to observe that only two spaces are printed.
  3. Close Formiko
  4. Open .ini file and observe that the setting has reverted totab_width = 2.

Changes to the boolean options in the .ini file are remembered between sessions, and do have the desired effects in the editor.

Does not render hard line break

I'm using formiko 1.3.0 installed on a Debian Bullseye system from the official Debian repos. Package python3-recommonmark version 0.4.0 is also installed from official Debian repos.

According to the CommonMark spec, ending a line with a backslash "\" should result in a hard line-break "<br />" in the parsed output.

However, in formiko, ending a line on a backslash, or space-then-backslash, or two spaces, has no effect. The text simply continues on the same line, unless I leave a blank line to start a new paragraph. As far as I can tell, there is no way to insert a line break except by typing in the whole html <br /> tag every time, which is both inconvenient and ugly.

I don't know whether this is a formiko bug, or a bug in the recommonmark library, but the absence of this fundamental formatting capability is a hindrance to formiko's usefulness.

Preview crashes on images inside links (Docutils)

The version I'm using is the latest AUR package (1.4.3-2), docutils is version 0.16.

When trying to preview a document with an image off the internet inside a link, the preview crashes.

Exception Error!

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/formiko/renderer.py", line 371, in render_output
    html = publish_string(**kwargs).decode('utf-8')
  File "/usr/lib/python3.10/site-packages/docutils/core.py", line 407, in publish_string
    output, pub = publish_programmatically(
  File "/usr/lib/python3.10/site-packages/docutils/core.py", line 665, in publish_programmatically
    output = pub.publish(enable_exit_status=enable_exit_status)
  File "/usr/lib/python3.10/site-packages/docutils/core.py", line 217, in publish
    self.document = self.reader.read(self.source, self.parser,
  File "/usr/lib/python3.10/site-packages/docutils/readers/__init__.py", line 71, in read
    self.parse()
  File "/usr/lib/python3.10/site-packages/docutils/readers/__init__.py", line 77, in parse
    self.parser.parse(self.input, document)
  File "/usr/lib/python3.10/site-packages/docutils/parsers/rst/__init__.py", line 191, in parse
    self.statemachine.run(inputlines, document, inliner=self.inliner)
  File "/usr/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 170, in run
    results = StateMachineWS.run(self, input_lines, input_offset,
  File "/usr/lib/python3.10/site-packages/docutils/statemachine.py", line 241, in run
    context, next_state, result = self.check_line(
  File "/usr/lib/python3.10/site-packages/docutils/statemachine.py", line 459, in check_line
    return method(match, context, next_state)
  File "/usr/lib/python3.10/site-packages/docutils/parsers/rst/states.py", line 2974, in text
    msg = self.reporter.severe(
  File "/usr/lib/python3.10/site-packages/docutils/utils/__init__.py", line 239, in severe
    return self.system_message(self.SEVERE_LEVEL, *args, **kwargs)
  File "/usr/lib/python3.10/site-packages/docutils/utils/__init__.py", line 197, in system_message
    raise SystemMessage(msg, level)
 docutils.utils.SystemMessage: :77: (SEVERE/4) Missing matching underline for section title overline.

 __________
 [![](https://spee.ch/OzK1u0v_BsLyXyoWS36RdRl0kMbMY-#5a485929c627d649542243733f26e4f97d859613)](https://odysee.com/using_odysee_is_bad_for_lbry:3e8aba56bddd1efe3aa3394802bdc585e45cc439)

It renders correctly on the Common Mark parser.

Nothing rendered in the preview pane

Using formiko v1.3.0 as packaged on Ubuntu 18.04, I get nothing rendered in the preview pane.

Have followed the instructions in the README.md of this repo and that hasn't helped.

Running formiko-vim from the CLI there are a couple of errors displayed.

E247: No registered server named "62B1E33A-1BC2-4E1C-8B60-55D079C9F3DB": Send expression failed.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/formiko/window.py", line 409, in refresh_from_vim
    row, col = self.editor.get_vim_pos()
  File "/usr/lib/python3/dist-packages/formiko/vim.py", line 75, in get_vim_pos
    buff, row, col, off = pos.split('\n')
ValueError: not enough values to unpack (expected 4, got 1)

FWIW - I'm using neovim, but I doubt this is an issue as the editor pane is working just fine with the embedded vim instance.

Default preview is vulnerable to XSS

Issue: The default markdown preview pane in formiko is vulnerable to XSS and loading arbitrary external content.

Steps to reproduce:

  • Open a new instance of formiko
  • Check that application is set to "Both" for the view
  • Paste the below code in the editor:
<script>
localStorage.setItem('test','i guess it renders')
document.write(localStorage.getItem('test'));
</script>
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/XOJAddj_SJE?controls=0" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>```

Better missing requirements information

If some requirement or suggest library was not found, formiko will tell it to user in some right, nice way.

More information about it is in #31 issue, which is about something different.

"quite with save?"

Exit window asks "Are you sure you to quite without save?".

Quite

Better wording would be "Are you sure you want to quit without saving?".

Common Mark option is grayed out

On my Arch Linux machine, in the settings drop-down, "Common Mark parser" is grayed out. Apparently it's necessary for viewing .md files. Why? It is not clear. I guessed that I needed to install cmark, but doing so did not help. Perhaps some other package for dealing with markdown or commonmark?

On a nearby Ubuntu machine, I installed formiko (using synaptic) and it shows .md files just fine. Works great! Using the common mark option in settings. Interesting: cmark is not installed.

What is different between the Arch machine and the Ubuntu machine? What to install on Arch to un-gray that option?

Using links to navigate between local files

User story: I am editing a collection of cross-linked Markdown files. When I click on a relative link, it should be treated as a local file link, so that I can jump between files while editing.

Suggested solution: When clicking on a relative link in Preview pane, close the current file and open the target file. (If the current file has not been saved, first prompt to save.)

Alternate solution: When clicking on a relative link in Preview pane, open the target file in a new Formiko instance. (If such an instance already exists, bring it to the foreground.)

Notes: At the moment the relative link opens the target file in the Preview pane. This means it appears but cannot be edited.

[BUG]gir1.2-webkit2-4.0 

on Lubuntu 24.04
E: Le paquet « gir1.2-webkit2-4.0 » n'a pas de version susceptible d'être installée
E: The "gir1.2-webkit2-4.0" package has no version that can be installed
work with gir1.2-webkit2-4.1

TypeError: 'NoneType' object is not callable

I get an exception on the following document:

* [Developing a Nifi custom processor](https://github.com/aperepel/nifi-workshop)
Removing the space between the * and the [ solves the exception.

This is the traceback:

Traceback (most recent call last):
  File "/app/lib/python3.7/site-packages/formiko/renderer.py", line 371, in render_output
    html = publish_string(**kwargs).decode('utf-8')
  File "/app/lib/python3.7/site-packages/docutils/core.py", line 416, in publish_string
    enable_exit_status=enable_exit_status)
  File "/app/lib/python3.7/site-packages/docutils/core.py", line 664, in publish_programmatically
    output = pub.publish(enable_exit_status=enable_exit_status)
  File "/app/lib/python3.7/site-packages/docutils/core.py", line 218, in publish
    self.apply_transforms()
  File "/app/lib/python3.7/site-packages/docutils/core.py", line 199, in apply_transforms
    self.document.transformer.apply_transforms()
  File "/app/lib/python3.7/site-packages/docutils/transforms/__init__.py", line 172, in apply_transforms
    transform.apply(**kwargs)
  File "/app/lib/python3.7/site-packages/formiko/renderer.py", line 50, in apply
    self.traverse(self.document)
  File "/app/lib/python3.7/site-packages/recommonmark/transform.py", line 303, in traverse
    newnode = self.find_replace(c)
  File "/app/lib/python3.7/site-packages/recommonmark/transform.py", line 283, in find_replace
    newnode = self.auto_toc_tree(node)
  File "/app/lib/python3.7/site-packages/recommonmark/transform.py", line 188, in auto_toc_tree
    content=['%s <%s>' % (k, v) for k, v in refs])
  File "/app/lib/python3.7/site-packages/recommonmark/states.py", line 101, in run_directive
    state_machine=self)
TypeError: 'NoneType' object is not callable

Version: 1.4.2 from flathub on Fedora 31.

formiko crashed and erased the content of the working file

I was enjoying formiko for the 5th day of trial, working on a .rst file.
Then formiko freezed.
Ok, no panic, I just waited until some error message may appear...
...But formiko just died, taking my work with him (I'm quite sure I heard a satanic laugh).
My file was still here, but empty. 0 Ko.
Even with recovery app, such as testdisk, no help.
This is bad.
[Ubuntu 18.04, gnome version, repos version of formiko]

Configure right margin?

Hi, is there a way I can change the right margin to something other than 80 columns? I can't see where in the code its being set.

Thanks 🙂

Numbered list not displayed correctly

Sample rst (also attached as test.rst in this ticket)

=============
List of items
=============

1. Point one

- eggs
- milk
- apples

2. Point two

   Test.

   *Test*

3. Point Three

   Test.

The numbered list is not in order (1. 2. 3.). It is displayed as (1. 1. 2.)

Gitit (that should use pandoc) and http://rst.ninjs.org could display the numbered list correctly.

Formiko and Retext (https://github.com/retext-project/retext) could not display the numbered list in order.
test.rst.txt

Fails on FreeBSD

When following the instructions, it fails on FreeBSD 12.1:

user@FreeBSD$ sudo pkg install py37-pygments py37-docutils py37-pip
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
pkg: gstreamer1-plugins-lame has a missing dependency: lame
pkg: k3b has a missing dependency: lame
The following 2 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
        py37-pip: 19.1.1 -> 20.2.3
        py37-pygments: 2.5.2 -> 2.7.1

Number of packages to be upgraded: 2

The process will require 2 MiB more space.
3 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/2] Fetching py37-pygments-2.7.1.txz: 100%    1 MiB   1.3MB/s    00:01    
[2/2] Fetching py37-pip-20.2.3.txz: 100%    2 MiB   2.1MB/s    00:01    
Checking integrity... done (0 conflicting)
[1/2] Upgrading py37-pygments from 2.5.2 to 2.7.1...
[1/2] Extracting py37-pygments-2.7.1: 100%
[2/2] Upgrading py37-pip from 19.1.1 to 20.2.3...
[2/2] Extracting py37-pip-20.2.3: 100%

user@FreeBSD$ sudo pip-3.7 install formiko
Collecting formiko
  Downloading formiko-1.4.3-py3-none-any.whl (115 kB)
     |████████████████████████████████| 115 kB 2.0 MB/s 
Requirement already satisfied: docutils>=0.12 in /usr/local/lib/python3.7/site-packages (from formiko) (0.15.2)
Installing collected packages: formiko
Successfully installed formiko-1.4.3

user@FreeBSD$ formiko
Traceback (most recent call last):
  File "/usr/local/bin/formiko", line 5, in <module>
    from formiko.main import main
  File "/usr/local/lib/python3.7/site-packages/formiko/main.py", line 11, in <module>
    from formiko.application import Application
  File "/usr/local/lib/python3.7/site-packages/formiko/application.py", line 10, in <module>
    from formiko.window import AppWindow
  File "/usr/local/lib/python3.7/site-packages/formiko/window.py", line 14, in <module>
    from formiko.sourceview import SourceView, View as GtkSourceView
  File "/usr/local/lib/python3.7/site-packages/formiko/sourceview.py", line 2, in <module>
    require_version('GtkSource', '3.0')     # noqa
  File "/usr/local/lib/python3.7/site-packages/gi/__init__.py", line 130, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace GtkSource not available

let me disable spell checking

It's nice that Formiko has spell checking for people who want it. But for those of us who don't, it's an unnecessary distraction. Please add an option to disable spell checking - thanks!

Can't say no to "reload from storage"

The message:

File test.rst has changed
Do you want to load from storage?

cannot be dismissed.

I'm using formiko 1.4.3 from the Arch User Repository which as far as I can see gets the package directly from github.

How to reproduce

Open any file.
Modify said file externally (for instance with vim).

Formiko will ask you whether you want to reload from storage, pressing yes will reload the file. If you press no, however, you will continuously get asked.

Workaround

Say yes and press CTRL+Z twice, that seems to take you back where you were.

Flatpak version: Excception Error!

When using the flatpack version on Ubuntu 22.04, with common mark parser, I got this error:

docutils.utils.code_analyzer.LexerError: Cannot analyze code. Pygments package not found.

Full stack trace:

Traceback (most recent call last):
  File "/app/lib/python3.9/site-packages/docutils/parsers/rst/directives/body.py", line 159, in run
    tokens = Lexer('\n'.join(self.content), language,
  File "/app/lib/python3.9/site-packages/docutils/utils/code_analyzer.py", line 61, in __init__
    raise LexerError('Cannot analyze code. '
docutils.utils.code_analyzer.LexerError: Cannot analyze code. Pygments package not found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/lib/python3.9/site-packages/formiko/renderer.py", line 371, in render_output
    html = publish_string(**kwargs).decode('utf-8')
  File "/app/lib/python3.9/site-packages/docutils/core.py", line 446, in publish_string
    output, pub = publish_programmatically(
  File "/app/lib/python3.9/site-packages/docutils/core.py", line 713, in publish_programmatically
    output = pub.publish(enable_exit_status=enable_exit_status)
  File "/app/lib/python3.9/site-packages/docutils/core.py", line 226, in publish
    self.apply_transforms()
  File "/app/lib/python3.9/site-packages/docutils/core.py", line 206, in apply_transforms
    self.document.transformer.apply_transforms()
  File "/app/lib/python3.9/site-packages/docutils/transforms/__init__.py", line 173, in apply_transforms
    transform.apply(**kwargs)
  File "/app/lib/python3.9/site-packages/formiko/renderer.py", line 50, in apply
    self.traverse(self.document)
  File "/app/lib/python3.9/site-packages/recommonmark/transform.py", line 313, in traverse
    self.traverse(child)
  File "/app/lib/python3.9/site-packages/recommonmark/transform.py", line 313, in traverse
    self.traverse(child)
  File "/app/lib/python3.9/site-packages/recommonmark/transform.py", line 303, in traverse
    newnode = self.find_replace(c)
  File "/app/lib/python3.9/site-packages/recommonmark/transform.py", line 285, in find_replace
    newnode = self.auto_code_block(node)
  File "/app/lib/python3.9/site-packages/recommonmark/transform.py", line 262, in auto_code_block
    return self.state_machine.run_directive(
  File "/app/lib/python3.9/site-packages/recommonmark/states.py", line 102, in run_directive
    return direc.run()
  File "/app/lib/python3.9/site-packages/docutils/parsers/rst/directives/body.py", line 166, in run
    raise self.warning(error)
docutils.parsers.rst.DirectiveError

A link referencing another document makes the preview crash

Try this mardown content example :

# test file
A link referencing another document in the same folder is crashing, example :
[crashing link](otherdoc.md)

That produce the following error in the preview pane :

Exception Error!

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/formiko/renderer.py", line 267, in render_output
    html = publish_string(**kwargs).decode('utf-8')
  File "/usr/lib/python3/dist-packages/docutils/core.py", line 407, in publish_string
    output, pub = publish_programmatically(
  File "/usr/lib/python3/dist-packages/docutils/core.py", line 665, in publish_programmatically
    output = pub.publish(enable_exit_status=enable_exit_status)
  File "/usr/lib/python3/dist-packages/docutils/core.py", line 220, in publish
    output = self.writer.write(self.document, self.destination)
  File "/usr/lib/python3/dist-packages/docutils/writers/__init__.py", line 78, in write
    self.translate()
  File "/usr/lib/python3/dist-packages/docutils/writers/_html_base.py", line 78, in translate
    self.document.walkabout(visitor)
  File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 214, in walkabout
    if child.walkabout(visitor):
  File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 214, in walkabout
    if child.walkabout(visitor):
  File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 206, in walkabout
    visitor.dispatch_visit(self)
  File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 1995, in dispatch_visit
    return method(node)
  File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 2018, in unknown_visit
    raise NotImplementedError(
NotImplementedError:  visiting unknown node type: pending_xref

If I preprend the link href with an "http://" or a "#" the exception disappear.

I think this is very problematic to not be able to use reference to other document in the same folder/tree.

PS: thank you very much for this software that is working really fine for me except for this bug 🙏

Vim support

README says:

Formiko have Vim editor support aka formiko-vim command. This run Vim editor in GtkSocket. At this
moment, this socket work only on X11 backend, so this is not work on Wayland yet.

It would be much better to use Neovim and its msgpack-rpc API (Python client). It would avoid the use of the X11-only GtkSocket and could provide much better Vim integration.

Feature: Multiple Editor Panes in The Window.

I love this program so much, and the major problem is not being able to edit two files at the same time. This would most likely be put in the editor pane, with either GtkNotebook or another two GtkPanes inside of it for tiling. I don't have much experience with python, but I might be able to get something in a fork if it sounds like something that you'd want here.

link handling and navigation

This Issue has some overlap with Issue #2, but is broader in scope.

I think the way links are handled in Formiko has a lot of room for improvement. Specifically:

  • There's no back button.
    It took me a while to notice that the right-click context menu in the preview pane has navigation options, and they seem to be always greyed out and inactive, even when I have just followed a link. I have tested this with local relative links and remote http:// links, in both two-pane and preview-only modes). The only way I can get the preview pane back to the document I started from is to close the Formiko window and open the document again.
  • There's no home button.
    There should be a one-click way to make the preview pane immediately return to the document that's currently open in the edit pane without having to backtrack through a browsing history.
  • "Open link in new window" does nothing.
    It doesn't open a new window or follow the link in the existing window.
  • There's no option to open links in external browser.
    It would be very helpful to have http:// and https:// URLs passed to my x-www-browser so they open as new tabs in Firefox, instead of having to deal with them in my markdown editor's preview pane.
  • Handling of local links is inconsistent
    Links formatted as [link text](file://file.md), [link text](file://./file.md) show up in blue like links, hovertext is the literal URL as-entered, clicking them does nothing. Links formatted as [link text](file:file.md) or [link text](file.md) work as expected, ie they show up in blue, hovertext shows the expanded full path to the file, and clicking opens the target file in the preview pane.
  • Relative links to local markdown or plain text files should open the target file for editing.
    I agree with @david_libremone in Issue #2 that the ideal behaviour when I click on a local link such as ./filename.md is to save & close the current file and immediately open the target file in the same window, keeping the view mode (preview-only vs dual-pane) at its current setting.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.