textualize / frogmouth Goto Github PK
View Code? Open in Web Editor NEWA Markdown browser for your terminal
Home Page: https://www.textualize.io/
License: MIT License
A Markdown browser for your terminal
Home Page: https://www.textualize.io/
License: MIT License
Tweak the colour scheme of the sidebar to use $panel
for the background.
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.
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
There are some handy plugins available to the underlying Markdown parser library we use, so do a review of them and see about adding any that would serve Frogmouth well.
For example, I can see a plugin that could help with #15.
This might actually be more of an issue for Textual itself, as perhaps some of these plugins will require further widget choices when rendering the Markdown
widget.
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.
The name as been decided: Frogmouth. Swap over the naming of commands and modules and stuff, and any "advertising" within the application.
Some people might prefer it on the right rather than the left. Add a way to flip it and make it store the state in config.
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...
Leverage https://pypi.org/project/pyhtml2md/ to convert any non-.md url into a markdown file and then render. also, handle any navigation to convert the nav-to page to md and render that.
Literally a TUI html-to-markdown browser
This way, I could configure things to behave more like other CLI tools I tend to use most often, e.g.:
/ find (if added)
q quit
e edit (if added)
: command mode
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.
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 = ....
Just my cents: if the tab header "Contents Local Bookmarks History" could be hidden by toggling, the screen would be even cleaner. Once users get familiar with key shortcuts for navigation, the header is no longer necessary.
The user can enter a command, directory or file name, and each one will do something slightly different. If those options are exhausted such that nothing will happen, provide some feedback (likely a simple error dialog) that says the input wasn't understood.
First, this is an awesome tool -- thank you for creating and maintaining it!
Would you be able to add this to Homebrew to make system-wide mac installs even easier?
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)
is it possible to optionally sow/hide:
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?
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!
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.
Use rothgar/awesome-tuis
as an example:
Just testing GitHub->Discord web hooks.
When in the history view, give the user the ability to remove individual items from history, or just clear the whole thing.
This might be a Textual thing rather than a frogmouth thing, but have a quick look into this and see if there's an underlying cause (perhaps test against a standalone version of similar tabs).
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'
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.
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:
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.
Hello there,
Firstly, thank you for this wonderful tool 🎉.
I wish I could copy the text inside the code-block into the clipboard.
If a folder contains a README.md
or readme.md
, it could open the readme when the folder is expanded.
if this is easily done, it would let users chose whatever color and hilighter they want.
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.
As the title suggests it would be awesome if I could navigate with the vim bindings .
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:
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.
When run against main
at least (what will be v0.21.0), it looks like the Markdown gets horizontally cropped for some reason, with no scrollbar appearing vertically. Investigate the cause.
I did the links in the dialog box using Rich links; but Textual links work differently. Switch over to them.
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.
At the moment, when changing root within the local file browser, I'm using remove
then mount
to set up a fresh DirectoryTree
. Once Textualize/textual#2448 makes it into a public Textual release update to use this approach.
This application was started before types screens with results was added to Textual (indeed, it was partially the catalyst for that being added after testing out the message approach it currently uses). It would be a good idea to rework dialogs such as YesNoDialog
and InputDialog
to use the new approach.
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.
Hi,
Would be nice to have a key to launch $EDITOR/$CURRENT_VIEW (or drop into a terminal in dir of the current view ?) for quickfixes.
Regards :).
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
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?
In doing so don't forget #26.
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?
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?
Any chance for Windows support?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.