Coder Social home page Coder Social logo

textualize / frogmouth Goto Github PK

View Code? Open in Web Editor NEW
2.3K 13.0 37.0 714 KB

A Markdown browser for your terminal

Home Page: https://www.textualize.io/

License: MIT License

Makefile 3.20% Python 96.80%
markdown markdown-viewer python terminal-based tui textual

frogmouth's People

Contributors

davep avatar kianmeng avatar tjni avatar tomjgooding avatar willmcgugan 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  avatar  avatar  avatar  avatar  avatar

frogmouth's Issues

Style review needed for bookmarks and history (at the very least)

Something seems to have changed in Textual recently (possibly the "style review" that took place a wee while back) that has broken how the history and bookmarks work in Frogmouth. Now, when they have focus, they end up with a double highlight border:

Screenshot 2023-07-20 at 08 30 08

which looks kind of ugly. Also, they don't scroll any longer. If a history or bookmark list is taller than the available space the cursor just wanders off the bottom, unseen.

Add support to launch $EDITOR?

If so, binding it to "e" would be a really convenient way to open the document in an editor.

At least on Linux, click.edit works pretty well for this.

click.edit(filename=...)

I haven't tried it on other systems though so I'm sure there could be some limitations.

Thanks again!

Cheers,
Keith

Feature request: add a callable refresh function

It would be great to have a way to refresh the content of a file using a key combo but also using some kind of programatic way (socket? external command?). This would be perfect for using the viewer in a preview splits with text editors like Vim and/or Tmux environments.

Possible to add find/search support?

Greetings!

Great work on frogmouth. It looks fantastic.

I have a few UI/behavior related requests. Going to report them in turn to keep things separated.

First -- any plans for find/search support?

Potential LaTeX rendering support

First, I got to say frogmouth is a very sweet addition for vim + markdown note taking, so thank you for creating it!

My question is whether it is feasible to have LaTeX support (or similar) for displaying mathematical formulas, similar to how MathJax / KaTeX are used with Markdown. I am not particularly aware of potential terminal limitations when it comes to the required rendering capabilities, but I would appreciate any ideas / suggestions / readings around the topic.

Thank you!

Support env-variable FROGMOUT_CFG_FILE to set the config-location

The config-file is currently hardcoded.

def config_file() -> Path:
    """Get the path to the configuration file.

    Returns:
        The path to the configuration file.

    Note:
        As a side-effect, the configuration directory will be created if it
        does not exist.
    """
    (config_dir := xdg_config_home() / ORGANISATION_NAME / PACKAGE_NAME).mkdir(
        parents=True, exist_ok=True
    )
    return config_dir / "configuration.json"

This is not virtualenv-friendly.

virtualenv allows to install multiple python-apps in parallel,
but it's problematic when they all want to use the same -configfile in $HOME

pleasa support setting this location by env-var:

> export FROGMOUT_CFG_FILE = ....

“Error loading the local document”

Hello,

Wonderful app, but recently, it does this strange behavior each time I launch it to open a file:

1691399656

  • Version is 0.8.0
  • Installed with pip3
  • Python version is 3.10.12
  • Ubuntu 22.04.3 LTS

Thanks!

Feature request: Support reStructuredText

While markdown got a lot of traction, reStructuredText ( https://docutils.sourceforge.io/rst.html ) is still very wide-spread especially among Python projects. More often than not when I run frogmouth gh <project> I have no success, as the project uses rst.

Would support for reStructuredText be completely out of scope for this project?

If there are no intentions to add support for it, I would love to see a more specific error message, e.g. something like:

The project is using the reStructuredText format which is not supported.

instead of...

Screenshot from 2023-07-27 07-58-41

search and highlight text

Feature request

Would it be possible to introduce a mechanism to search and highlight (searched) text? I do not know if Textualize enables such a thing easily enough, however noticing that all other terminal pagers do I thought it could be a feature that should somehow be proposed :).

Along the same lines of this other issue other terminal pagers (see less for example) default the search to / á la vim: given that other vim bindings are included by default (as you mention in the comments of that issue), I was wondering if there is a particular reason why / currently invokes the title bar instead?

Investigate the options for [[Wiki Linking]] type links

A common request/observation on release day was "this is so close to a TUI Obsidian client, can that happen?"; right now it can be used to view individual Obsidian files -- they are mostly Markdown after all -- but the linking between documents facility within a vault obviously isn't there.

As an initial step to this, look at the options for handling the wiki-a-like linking that Obsidian uses. Perhaps there's a plugin for Markdown-it; if not perhaps it would be possible to write one with it?

Switch the sidebar to more of a show/hide approach

At the moment the sidebar only shows if you press the hotkey for a particular pane, and it then goes away again if you select something from one of those panes. While keeping the hotkeys, have a general show/hide key and don't auto-hide the sidebar.

Rename/rebrand all the things

The name as been decided: Frogmouth. Swap over the naming of commands and modules and stuff, and any "advertising" within the application.

Add a last-ditch attempt to see if there's an md file on the end of a URL

Currently Frogmouth makes a pretty simple check to see if a file at the end of a URL is a Markdown file; quite simply by looking at the name of the file and seeing if its extension is one of the "standard" extensions. The advantage of this is that it's going to work in almost all situations where someone's wanting to view a remote markdown file, and it's not an expensive decision to make (no call out to a remote resource is needed before deciding to try).

As #77 has demonstrated though, there's some merit, albeit likely less-frequently needed, in diving a little deeper. I don't think we should dive deeper every time we're looking at a URL; but I think there's no harm in Frogmouth, once it's decided to just open the URL up in the browser, checking if there's a redirect (with a HEAD request) and having one final glance at where the request will end up.

Doing it this way will have the benefit of only making the "expensive" decision once all other routes to loading the file have failed.

Support HTML

HTML support would transform this into a powerful TUI browser, with easy chapter navigation which isn't standard in browsers, but very very useful.

Using a tool like markdownify to convert HTML to Markdown, would transform Frogmouth into a general purpose browser, yet leave things as is in terms of compatibility.

Toggle table of contents (or other menu items)

Thank you for frogmouth, it's awesome!

At the moment a set of shortcuts are allowed, say ctrl-t/n/b/l to show specific items of the menu: would it be possible to make such keymaps toggle rather than just open? Practically speaking, if I use ctrl-t to quickly show the table of content, I would expect to be able to quickly hide it back again without moving the hands from the keys (instead of having to use ctrl-n to toggle-hide the whole menu)

Move the help away from being an in-viewer document and into a modal

While I'm a fan of having the help appear in the viewer itself, there is a good argument for making it a modal dialog that pops up over whatever is being viewed.

After making the change, ensure that if the user types help into the omnibox, that it goes back to showing the URI.

Unable to open relative images / resources when md file is not in current dir

Current behaviour

Frogmouth is not able to open resources relative to the current markdown file when that is not in the current directory. For example, for a file and image in a doc directory:

mkdir doc
curl https://placekitten.com/100/100 > doc/cat.png
cat > doc/README.md
# Hello

[Some image](cat.png)
frogmouth doc/README.md

Clicking on the "Some image" link brings up a "Does not exist" box:

Screenshot from 2023-05-27 23-19-45

Expected behaviour

Browser window opens with the image.

This behaviour happens when frogmouth runs in the doc directory, so it's able to open files when they're in the current dir.

cd doc
frogmouth README.md

However, when opening files by passing a file in a different directory, or using the navigation to load a file in an alternate directory, relative paths from markdown no longer work.

No module named 'frogmouth'

I installed it via on Arch from the AUR via yay. After starting I just get the following error message:

Traceback (most recent call last):
File "/usr/bin/frogmouth", line 5, in
from frogmouth.app.app import run
ModuleNotFoundError: No module named 'frogmouth'

update textual dependence

Hi, I tried to install frogmouth on my local windows.

C:\Users\Liu.D.H>pip install -i https://pypi.org/simple -U frogmouth
Collecting frogmouth
  Downloading frogmouth-0.5.0-py3-none-any.whl (39 kB)
Requirement already satisfied: httpx<0.24.0,>=0.23.3 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from frogmouth) (0.23.3)
Collecting textual<0.25.0,>=0.24.0 (from frogmouth)
  Downloading textual-0.24.1-py3-none-any.whl (392 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 392.8/392.8 kB 1.3 MB/s eta 0:00:00
Collecting typing-extensions<5.0.0,>=4.5.0 (from frogmouth)
  Downloading typing_extensions-4.6.1-py3-none-any.whl (31 kB)
Collecting xdg<7.0.0,>=6.0.0 (from frogmouth)
  Downloading xdg-6.0.0-py3-none-any.whl (3.9 kB)
Requirement already satisfied: certifi in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from httpx<0.24.0,>=0.23.3->frogmouth) (2023.5.7)
Requirement already satisfied: httpcore<0.17.0,>=0.15.0 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from httpx<0.24.0,>=0.23.3->frogmouth) (0.16.3)
Requirement already satisfied: rfc3986[idna2008]<2,>=1.3 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from httpx<0.24.0,>=0.23.3->frogmouth) (1.5.0)
Requirement already satisfied: sniffio in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from httpx<0.24.0,>=0.23.3->frogmouth) (1.3.0)
Requirement already satisfied: importlib-metadata>=4.11.3 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from textual<0.25.0,>=0.24.0->frogmouth) (4.13.0)
Requirement already satisfied: markdown-it-py[linkify,plugins]<3.0.0,>=2.1.0 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from textual<0.25.0,>=0.24.0->frogmouth) (2.2.0)
Requirement already satisfied: rich>=13.3.3 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from textual<0.25.0,>=0.24.0->frogmouth) (13.3.5)
Requirement already satisfied: h11<0.15,>=0.13 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from httpcore<0.17.0,>=0.15.0->httpx<0.24.0,>=0.23.3->frogmouth) (0.14.0)
Requirement already satisfied: anyio<5.0,>=3.0 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from httpcore<0.17.0,>=0.15.0->httpx<0.24.0,>=0.23.3->frogmouth) (3.6.2)
Requirement already satisfied: zipp>=0.5 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from importlib-metadata>=4.11.3->textual<0.25.0,>=0.24.0->frogmouth) (3.13.0)
Requirement already satisfied: mdurl~=0.1 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from markdown-it-py[linkify,plugins]<3.0.0,>=2.1.0->textual<0.25.0,>=0.24.0->frogmouth) (0.1.2)
Requirement already satisfied: linkify-it-py<3,>=1 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from markdown-it-py[linkify,plugins]<3.0.0,>=2.1.0->textual<0.25.0,>=0.24.0->frogmouth) (1.0.3)
Requirement already satisfied: mdit-py-plugins in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from markdown-it-py[linkify,plugins]<3.0.0,>=2.1.0->textual<0.25.0,>=0.24.0->frogmouth) (0.3.3)
Requirement already satisfied: idna in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from rfc3986[idna2008]<2,>=1.3->httpx<0.24.0,>=0.23.3->frogmouth) (3.4)
Requirement already satisfied: pygments<3.0.0,>=2.13.0 in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from rich>=13.3.3->textual<0.25.0,>=0.24.0->frogmouth) (2.14.0)
Requirement already satisfied: uc-micro-py in c:\users\liu.d.h\appdata\local\programs\python\python311\lib\site-packages (from linkify-it-py<3,>=1->markdown-it-py[linkify,plugins]<3.0.0,>=2.1.0->textual<0.25.0,>=0.24.0->frogmouth) (1.0.1)
Installing collected packages: xdg, typing-extensions, textual, frogmouth
  Attempting uninstall: typing-extensions
    Found existing installation: typing_extensions 4.4.0
    Uninstalling typing_extensions-4.4.0:
      Successfully uninstalled typing_extensions-4.4.0
  Attempting uninstall: textual
    Found existing installation: textual 0.26.0
    Uninstalling textual-0.26.0:
      Successfully uninstalled textual-0.26.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow-intel 2.12.0 requires numpy<1.24,>=1.22, but you have numpy 1.24.3 which is incompatible.
trogon 0.2.1 requires textual>=0.26.0, but you have textual 0.24.1 which is incompatible.
Successfully installed frogmouth-0.5.0 textual-0.24.1 typing-extensions-4.6.1 xdg-6.0.0

C:\Users\Liu.D.H>

And I noticed that textual is downgraded to old versions, so maybe it's conflict with trogon and may not work together.

How about update this dependence?

YAML front matter

YAML front matter is a common feature for static site/blog generators and Python documentation tools, but frogmouth handles it weirdly. Unclear if it's within scope.

The front matter for one of my blog posts in VS Code:

Screenshot 2023-04-30 at 2 10 50 PM

The front matter in frogmouth:

Screenshot 2023-04-30 at 2 05 12 PM

Allow for overriding styles in a stylesheet held in the configuration directory

Frogmouth's code holds all of the styling in the code, mostly in DEFAULT_CSS on the relevant widget, with a bit over "overall" styling in DEFAULT_CSS on the main screen.

It would be useful, however, if an end user, with some knowledge of the styling options, could override those styles in a stylesheet of their own; but not one that is shipped with and as part of the application, instead one that is optionally held outside of the installation directory (most likely held in the configuration directory -- ~/.config/textualize/frogmouth on most systems).

I need to check if this can be done as part of Textual's current stylesheet loading system (is it possible to attempt to load a stylesheet that doesn't exist without that being an error?), and if not perhaps explore the idea of adding such support to Textual.

Feature request: Synchronized table of contents in a secondary sidebar

Could a secondary sidebar be populated with first/second/third level headings in a collapsible tree-like fashion, and navigate to those headings in the browser panel when clicked? Bonus points if the highlighted heading in the sidebar also synchronizes with the current position in the browser (even collapsing when leaving that nested level?).

Of course this is fairly complex logic, which is why it isn't even implemented in most full-fledged documentation themes, so it might be a tall order! The PyData Sphinx theme does it, for example.

Ability to configure browser to open links

Hi,

I was just playing around with this and it seems to try to use lynx or w3m as the browser to open links.

I would like to configure this to use my system browser, usually this is something like open <LINK> in the terminal.

Thanks

Add history cleaning support

When in the history view, give the user the ability to remove individual items from history, or just clear the whole thing.

Add some extra navigation bindings to the main viewer

The navigation pane has bindings that are friendly to folk who like to use WADS and vim cursor-style keys; but I forgot to extend this to the main viewer pane too. This seems like an oversight and one worth fixing.

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.