A tool to generate macOS QuickLook previews for YAML files

Latest Release: 1.2.0

 

How to Use PreviewYaml

Install the app and run it. This will register the availability of the app’s QuickLook extensions, Yaml Previewer and Yaml Thumbnailer. You can now quit the app: just click OK:

The PreviewJson main UI

 
To use QuickLook in Finder, select a YAML file — one with the extension .yaml, for example — and press space. This will pop up a rendered preview of the file:

The PreviewJson main UI

 
You will also see YAML file previews in Finder’s preview pane, enabled using View > Show Preview or by hitting Cmd-Shift-P, and in the Preview: section of Finder’s file info panel (select a file and hit Cmd-I).

You can disable or re-enable Yaml Previewer and/or Yaml Thumbnailer in System Preferences > Extensions:

macOS Ventura system settings for extensions

Customise the Preview

Open the Preferences panel from the main app’s PreviewYaml menu. This allows you to adjust some of the key elements of the preview:

  • The colour of mapping keys.
  • The colour of string values.
  • The colour of special values, eg. NaN, ±INF.
  • The preview’s font and style.
  • The preview’s text size, from 10pt to 28pt.
  • The level of indentation.
  • Whether keys should be presented in alphabetical order.
  • Whether previews should be displayed dark-on-light even in macOS Dark Mode.
  • Whether previews should include raw YAML if rendering fails because the YAML was malformed.

Choose your preferred text size using the slider, then pick the monospace font you want the file to be presented in.

Choose your preferred key, string value or special value colour by clicking the Colours: popup and then use the colour well to choose the colour itself:

The PreviewJson main UI

 
Click Save to apply your choices.

Changing these settings will affect previews straight away.


Feedback and Bug Reports

You can use the main app to submit feedback. Just click in the Send Feedback button in the main window, or select Report a Bug… from the Help menu:

macOS Ventura system settings for extensions

 
Please include your email address if you would like a response. I can’t respond without one. Please see the privacy policy for details of email address usage.


Troubleshooting

If PreviewYaml reports that it was unable to render YAML, this is almost certainly caused by a malformation of the YAML itself — the error message should help you spot the problem. PreviewYaml’s YAML library is quite strict, so YAML malformations which other apps allow may be rejected by PreviewYaml. For this reason, you can optionally tell PreviewYaml to display a file’s raw YAML in the event of a parsing error. This option is chosen in the Preferences panel and will allow you to QuickLook even bad YAML files, just without rendering.

Known Issues

Certain YAML features, including custom tags, are not as yet correctly rendered by PreviewYAML.


Enjoyed Using PreviewYaml?

If you have found PreviewYaml to be useful, please consider writing a positive review on the Mac App Store, or simply give it a rating.

Thank you!


Acknowledgements

PreviewYaml makes use of code from the following sources:

  • YamlSwift — Yaml-to-NSAttributedString conversion.

Source Code

You can view PreviewYaml’s source code at GitHub.


Release Notes

  • 1.2.0 25 August 2023
    • Make the alphabetical sorting of keys optional. Default, do sort.
    • Make the display of key colon symbols a setting. Default, do not show.
    • Allow users to choose the colours of strings and special values (NaN, ±INF).
  • 1.1.5 14 February 2023
    • Fix regression affecting thumbnails of large documents.
  • 1.1.4 21 January 2023
    • Add link to PreviewText.
    • Better menu handling when panels are visible.
    • Better app exit management.
    • Bug fixes.
  • 1.1.3 2 October 2022
  • 1.1.2 27 August 2022
    • Initial support for non-utf8 source code file encodings..
  • 1.1.1 19 November 2021
    • Disable selection of thumbnail tags under macOS 12 Monterey to avoid clash with system-added tags.
  • 1.1.0 28 July 2021
    • Allow any installed monospace font to be selected.
    • Allow any font style to be applied.
    • Allow any key colour to be chosen using macOS’ colour picker.
    • Indent multi-line text.
    • Tighten thumbnail rendering code.
    • Fixed a rare bug in the previewer error reporting code.
  • 1.0.1 17 June 2021
    • Add links to other PreviewApps.
    • Support macOS 11 Big Sur’s UTType API.
    • Stability improvements.
  • 1.0.0 11 May 2021
    • Initial public release.

Related Software


smittytonesmittytone
Site and software copyright © 2024, Tony Smith