sbarex / SourceCodeSyntaxHighlight

Quick Look extension for highlight source code files on macOS 10.15 and later.
GNU General Public License v3.0
2.88k stars 72 forks source link

Support for files used by open source R project such as '.Rmd' #179

Closed massisenergy closed 2 years ago

massisenergy commented 2 years ago

Hi,

I used to like the simple qlColorCode as had a very simple procedure (Adding Language Types) to add any filetypes by the end user. But it's not working in M1Pro and I find this app is beautiful and feature loaded.

My questions are –

  1. Can you allow such procedure for the end user to add file types according to their needs?
  2. If not, can you add this into the app:
$ mdls -name kMDItemContentType -name kMDItemContentTypeTree ~/Downloads/testing.fun.Rmd
kMDItemContentType     = "dyn.ah62d4rv4ge81e5pe"
kMDItemContentTypeTree = (
    "public.item",
    "dyn.ah62d4rv4ge81e5pe",
    "public.data"
)

.Rmd (R-markdown) files are like simple text files. R is a free programming language and software environment for statistical computing and graphics.

$ cat ~/Downloads/testing.fun.Rmd
---
title: 'R Notebook: learning functions, purrr, nesting and more'
author: "SM"
date: "`r format(Sys.time(), '%d %B, %Y')`"
urlcolor: blue
output:
  html_document:
    toc: yes
    theme: flatly
    highlight: tango
    toc_depth: '3'
    df_print: paged
  html_notebook:
    toc: yes
    toc_depth: 3
    toc_float: yes
    theme: flatly
    highlight: tango
geometry: margin=.5in, bottom=.75in
---

This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you execute code within the notebook, the results appear beneath the code.

Try executing this chunk by clicking the *Run* button within the chunk or by placing your cursor inside it and pressing *Cmd+Shift+Enter*.

```{r setup, include=T, message=F}
library(here); library(tidyverse); library(ggplot2); library(kableExtra);
library(tgp); library(furrr);

source(file = "/Users/sourav/Sync/Programming/R/Load_packages.R");
load("/Users/sourav/Sync/2019PD/2019PD_Project_Sourav/E3DPB/DOE_ERR_SM/DOE_R/Data/DOE3MaterialsPairs20200616.Rdata")
# knitr::opts_knit$set(root.dir = "~/Sync/Programming/R")
knitr::opts_chunk$set(echo = TRUE);

Note, I had to truncate the file as it involves '```' characters which I don't know to comment out here.

If it can be visualised through Syntax-highlight, then it would be great (simple quicklook preview is also fine if colouring is not happening).

sbarex commented 2 years ago

Hi, you can't edit the .plist file because this breaks the code signing of the app. To change the plist you have to edit the source and then recompile the whole app.

By choice, this application does not handle markdown files because most users expect to see the final formatting for this type of file and not its source code.

However, I created a special application for viewing files in markdown format QLMarkdown. This app render the markdown files, but also can show the source code if you want.

massisenergy commented 2 years ago

Superb. Many thanks for your quick response to guide me towards what I was looking for and QLMarkdown works perfectly. Didn't understand fully I guess, but for me this use case is recurrent –

Zip through a lot of old .Rmd files in the Finder quickly, found via search and use quicklook to find a particular piece of source code and then open it.

sbarex commented 2 years ago

guess option is used to autodetect the syntax of the fanced code blocks that do not have set the syntanx language.