Search code examples
urlbrowseryaml

Open links in a yaml file


How can I view a yaml file and be able to click on URLs to open them in a browser?

For example, I have this tiny yaml file test1.yaml with 2 URLs:

foo:
  - baz: bletch quux
    qux: https://www.google.com/search?q=bletch
  - baz: quux foobar
    qux: https://www.google.com/search?q=foobar

If I type into the Google Chrome browser the path to the file: file:///Users/user_name/test/test1.yaml, it is downloaded (not opened), as expected.

I am looking for a quick and easy way to open a yaml file and make the URLs in it clickable. Are there any browsers (or browser extensions/add-ons), editors, or others apps?

The method should be suitable for casual computer users who are not developers, and should work on both macOS and Windows.


Current workaround

(long and moderately difficult for my users)

So far, I found this: https://jsonformatter.org/yaml-viewer

I open this website, click on "load data", and select my yaml file. It is opened by this web app, and, after a delay, displays this:

open 1

I can then click on the closed nodes in the right half of the window, to open them as needed, until the entire yaml file is displayed.

I can then click on the individual links to open each one of them:

open 2


Solution

  • Open them in VS Code, hold Command (Ctrl for non-Mac users I guess) and click the link. Some other editors (e.g. Zed) support this as well.

    iTerm2 also supports this for all text displayed, so basically you can cat the file and click on the link.