Git Product home page Git Product logo

qlmarkdown's Introduction

QLMarkdown

by Phil Toland

fixes and improvements by Michael Dominic K. http://www.mdk.org.pl

Introduction

QLMarkdown is a simple QuickLook generator for Markdown files. It renders a preview of the selected Markdown file using Discount -- a C implementation of John Gruber's Markdown.pl script.

To update to the latest version of discount run ./discount-config/update-discount.sh

For more information on Markdown see http://daringfireball.net/projects/markdown/.

Installation

Simply copy QLMarkdown.qlgenerator to ~/Library/QuickLook or /Library/QuickLook.

If the newly installed plugin is not picked up instantly, you can run qlmanage -r in Terminal to refresh.

To uninstall, drag QLMarkdown into the trash.

Another method, provided you have Homebrew Cask installed, you can run the following commands to set things up:

$ brew update

$ brew cask install qlmarkdown

To uninstall:

$ brew cask uninstall qlmarkdown

Note: QuickLook doesn't allow selecting text by default. If you want to select the text in the markdown preview, you will need to enable text selection in QuickLook by running the following command in Terminal:

defaults write com.apple.finder QLEnableTextSelection -bool TRUE; killall Finder

This command is only valid on OS X 10.10 and below as Apple has since removed the ability to select text in QuickLook.

Downloads

Source code is available at http://github.com/toland/qlmarkdown.

You can download the latest release from https://github.com/toland/qlmarkdown/releases

License

The QLMarkdown code is distributed under the same terms as Discount. See the file discount/COPYRIGHT for more information.

Version History

Version 1.3 - Jan 26, 2012

  • Major update of discount markdown engine

Version 1.2 - Oct 4, 2009

  • Work around a conflict with MacVim (thanks to godDLL)
  • Support for .mdml extension (alanhogan)
  • CSS that mimics Apple's ADC styling (jiho)

Version 1.1 - Feb 11, 2009

  • Adding a little bit of CSS styling. (mdk)
  • Replace the Perl markdown renderer with a native C one (discount). (mdk)
  • Conform to public plain-text. Will make spotlight index the file contents. (mdk)
  • Added support for .md file extension (sant0sk1)

Version 1.0 - July 15, 2008

  • Initial release.

qlmarkdown's People

Contributors

alanhogan avatar booch avatar chrisfinazzo avatar cliotropic avatar ctesniere avatar dbr avatar hivehand avatar homebysix avatar jerodsanto avatar jiho avatar josiahwiebe avatar ktf avatar lemeb avatar maddthesane avatar majjoha avatar mathiasbynens avatar mdk avatar olofsjod avatar rchowe avatar silum avatar sparanoid avatar tarwich avatar tattali avatar th507 avatar thomasaw avatar vitorgalvao avatar vividvisions 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  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

qlmarkdown's Issues

Add option to switch back to vanilla styling

In #75 we gained the ability to have our markdown look like GitHub, which was a huge win. However, it opens the door for debate on whether a user should be able to choose their style of markdown. Perhaps we should have a way of choosing the "theme" that will be applied to the markdown previewer.

Crash on preview

When trying to quicklook this markdown file, QLMarkdown crashes. I have the feeling it's an encoding issue. The file is encoded in ISO Latin-1, not UTF-8.

in urls tilde characters get url encoded - this breaks some links

This is not the usual markdown behaviour and breaks links like http://localhost/~xyz/ as they are converted to http://localhost/%7Exyz/.

workaround: using html.
instead of: <http://localhost/~xyz/>
this will work: <a href="http://localhost/~xyz/">http://localhost/~xyz/</a>

files with MacRoman-encoded ellipses crash QLMarkdown 1.2

I had a file encoded in MacRoman (TextEdit's default default) that had an ellipsis (…) in the middle of it. Trying to view this file with QLMarkdown 1.2 crashed QuickLook.

As it turns out, a file containing a single MacRoman-encoded ellipsis will crash QLMarkdown 1.2.

I'll see if I can't change the relevant bits to use +[NSString stringWithContentsOfURL:usedEncoding:error:] or its -init… counterpart.

Update the render after each file modification

First, thanks for the neat plugin!

Currently the plugin renders a .md file and up to one modification of that .md file. After watching the render window for five minutes, no more re-rendering occurs. Any file-modifications (like if I edit the .md file) are not propagated to the QuickLook window.

I desire for the QuickLook window to refresh upon each change (forward in time, backwards in time) to the file modification date.

OSX 10.10.5. QLMarkdown version:

~/frameworks/qlmarkdown (master)$ brew cask info qlmarkdown
qlmarkdown: 1.3.3
QLMarkdown
https://github.com/toland/qlmarkdown
/opt/homebrew-cask/Caskroom/qlmarkdown/1.3.3 (9 files, 196K)
https://github.com/caskroom/homebrew-cask/blob/master/Casks/qlmarkdown.rb
==> Contents
  QLMarkdown.qlgenerator (qlplugin)

Q: Is this something handled by the plugin or by QuickLook framework itself?

How to get to QLMarkdown.qlgenerator

In the zip file that you offer, I can not find the QLMarkdown.qlgenerator. Should I using Xcode to compile the QLMarkdown.xcodeproj in the Xcode? Thank you very much!

Plans for a new release?

Hi. Is there any chance of a new release? Looks like there have been quite a few changes since the last release, including GitHub styles, which would be really cool.

Feature request: better preview column

When using Finder in column view and you have a file selected, a column is shown to the right with a preview of the file and some metadata (if enabled, which it is by default). Currently QLMarkdown causes this to be an image of a page, on which actual text is rendered at an unreadably small size. It would be very nice if, instead, the content of the preview column were the same as the content of the popup that shows when you hit space.

This is currently the behavior of QLStephen, if you want a reference.

How do you run qlmarkdown?

I hate to sound dense but how do you actually use this to view a .md file? I installed it on MacOS 10.12 but there's no executable in /usr/local/Caskroom/qlmarkdown. And if I right-click a .md file, and select "Open with...", it's not an option.

Yosemite version

Didn't find an issue mentioning a Yosemite version so I'm creating this one. Please feel free to add or correct if there already is one. :-)

thx

QL only works for *.markdown

I’m not sure whether this is a bug or if I did something wrong but the QL works only for files ending with .markdown. I took a look at the Info.plist and fount several other suffixes that should work, but they don’t:

file             QL result    program
–––––––––––––––––––––––––––––––––––––––––––
test.markdown    works        TextWrangler
test.md          plain        TextEdit
test.mdml        nothing      none
test.mdown       nothing      TextWrangler
test.mdwn        nothing      none
test.mkd         nothing      Brackets
test.mmd         nothing      none
test.text        plain        TextEdit

This is how it looks, when it …
… works
works
… is plain text
plain
… doesn’t work
doesn’t work

I have no plugins installed in ~/Library/QuickLook and in /Library/QuickLook I have iBooksAuthor.qlgenerator, iWork.qlgenerator and QuickLookEyeTV.qlgenerator. I restarted my mac, the Finder and tried qlmanage -r without success.

If it is a bug I hope you can fix it if not you might can help anyways ;-)

Can not preview markdown file in a bundle

I found a .md or .markdown file is work, but it will not be preview when I move it to a app bundle .

I check some other quick look plugin, and they work in the bundle.

SHA256 checksum mismatch when installing with Brew

$ brew cask install qlmarkdown
==> Downloading https://github.com/toland/qlmarkdown/releases/download/v1.3.3/QLMarkdown.qlgenerator.zip
######################################################################## 100.0%
==> Note: running "brew update" may fix sha256 checksum errors
Error: sha256 mismatch
Expected: 045712562665673924397bbbef1ee1157b44e23c9744feda6feda27e107802d3
Actual: acbc1b10fc571643058129ffcb6888f2cf3d0641fe04be5b304d1324d8754f76
File: /Library/Caches/Homebrew/qlmarkdown-1.3.3.zip
To retry an incomplete download, remove the file above.

I've tried brew update and deleting the temp file+retrying, same thing

base tag and img location problem

markdown.m

  • 25 line "<base href=\"%@\"/>"
  • 29 line styles, url, [NSString stringWithUTF8String:output]];

base tag print "<base href=\"http://localhost/Users/.../sample.md\"/>"
it is make problem not print image

i fix it source

  • 25 line "<base href='file:///%@/' />"
  • 29 line styles, [url.path stringByDeletingLastPathComponent], [NSString stringWithUTF8String:output]];

 2013-03-28 4 58 01

What version of OSX are you running?

Ok, I thought that this project would be gone by now, because

  • I thought that Mavericks would have it native (Mavericks is old news, I know)
  • I thought that everyone would abandon this project for something better

Since people are still around, I'm going to recompile it. However, I'm on Yosemite, and I want to know how many versions back I need to support. Please send me your infos and I'll start setting up a Travis build system.

# Get the infos
system_profiler SPSoftwareDataType
# --or--
# Directly into clipboard (pasteboard)
system_profiler SPSoftwareDataType | pbcopy

Here's mine:

System Software Overview:

  System Version: OS X 10.10.3 (14D136)
  Kernel Version: Darwin 14.3.0

OS X 10.7.4 broken

Hi, I'd love to have this plugin. I've tried

  • compiling from source
  • extracting precompiled
  • into ~/Library/QuickLook
  • and /Library/QuickLook
  • rebooting machine, relaunching Finder

but QuickLook still shows the plaintext *.md

extension .md not recognized

I installed QLMarkdown on OS X 10.8.4 (Mountain Lion), but it didn't work for other extensions than .markdown.
Tried putting it in either /Library/QuickLook/ or ~/Library/QuickLook/ did not solve the problem.

Removing QLStephen and QLColorCode qlgenerators to avoid interference didn't either.

I have Mou installed, which exports the UTI. I also tried Texts, which has a QuickLook plugin, but for it only the extension .text was recognized and associated with net.daringfireball.markdown. I removed it to avoid interference with QuickLook priorities.

debugging with qlmanage -p -d 1 file.md shows that there is no UTI type associated to the extension .md, because I get: Content type UTI: com.unknown.md.

Eventually I used LookDown, which didn't work either as it shipped. To make it work I had to relocate its QuickLook generator QuickLookDown.qlgenerator from LookDown.app/Contents/Library/QuickLook/ to ~/Library/QuickLook/ and then add <string>com.unknown.md</string> in its:

<key>CFBundleDocumentTypes</key>
<array>
    <dict>
        <key>CFBundleTypeRole</key>
        <string>QLGenerator</string>
        <key>LSItemContentTypes</key>
        <array>
            <string>net.daringfireball.markdown</string>
            <string>com.unknown.md</string>
        </array>
    </dict>
</array>

Although this eventually solved my problem, since it is clearly a hack (the UTI remains undefined/unexported for that extension, despite Mou.app exporting it) I would much appreciate a proper solution.

I am new to UTIs and so I hope the above description isn't too messy.

should include net.multimarkdown.text UTI

On one of my machines, QLMarkdown works perfectly. On another, it doesn't preview .markdown files as I'd expect; instead I just get the standard text preview.

The difference between the two machines seems to be that on the machine on which things work a copy of Mac Vim is installed; the machine on which things don't work doesn't have that installed.

That wasn't a great workround so I looked into this a bit harder with the qlmanage tool. I found that the issue was the UTI determined for the file. On the machine with Vim installed, it was resolved to net.daringfireball.markdown while on the other it resolved to net.multimarkdown.text.

Adding net.multimarkdown.text manually to the Info.plist file in the QLMarkdown bundle alongside the other two types fixed things for me.

Support for inline code spans using backtick quotes (`)

Though code blocks display nicely with gray background wrapped around them, the inline code spans do not get wrapped in a similar grayed background. Though the text surrounded in backticks does get converted to a monospace font, it still doesn't really pop out compared to the rest of the text. This sentence is wrapped in backticks and you can easily see it because of the gray background. Would it be possible to enhance the inline code spans in this way to make them more noticeable?

More details about this syntax feature can be found on DaringFireball's Markdown Syntax Explanation.

Feature Request: Copy text directly from QuickLook

I would love to be able to copy text directly from QuickLook.

I used defaults write com.apple.finder QLEnableTextSelection -bool TRUE; killall Finder to be able to select the text inside QuickLook, but I am not able to copy it by using + C.

Currently this is working for native files like .rft only. Markdown previews generated by this plugin are not responding to the shortcut.

Doesn't work with QL from the terminal

This is an edge-case, but... I like to use QuickLook from the Terminal. This is "qlmanage -p", but there's a handy alias for both .bashrc and .zshrc:
ql () { qlmanage -p "$*" >& /dev/null; }
(no preceding "alias" required for either).

qlmarkdown definitely adds QuickLook support for MD files from the Finder (thanks!), but this seems to break from the command line... Causes both zsh and bash to hang, in both Terminal and iTerm2.

Being able to QuickLook an MD file from the terminal immediately after having pulled down a git repo would be nirvana!

Brew support

Is it possible to provide brew support for your awesome extension?

Support for dynamic UTIs

I reinstalled Mavericks, and now my UTI for .md files (as reported by mdls) is dyn.ah62d4rv4ge8043a. According to this article on UTIs, that translates to ?0=6:1=md, which means UTTypeConformsTo= public.data:public.filename-extension=md.

Long story short, adding dyn.ah62d4rv4ge8043a to the Info.plist makes it work.

Use Pandoc as markdown converter

Hello

Pandoc is a really cool markdown converter. Is it possible to use it as the default converter in qlmarkdown?

Thank you.

Link

If the link's url contains parentheses, like

[foo](bar://some-url-with-(parentheses)-in-it)

The QuickLook will be

screen shot 2017-07-03 at 20 48 22

FYI:
qlmarkdown version 1.3.5
OS X 10.12.5

Can't install with brew on macOS 10.12.4

I’m trying this on macOS 10.12.4:

brew update && brew cask install qlmarkdown

But getting this:

warning: unable to unlink .travis.yml: Permission denied
warning: unable to unlink .yardopts: Permission denied
warning: unable to unlink CONTRIBUTING.md: Permission denied
warning: unable to unlink SUPPORTERS.md: Permission denied
fatal: cannot create directory at '.github': Permission denied
Error: Failure while executing: git pull --ff --no-rebase --quiet origin refs/heads/master:refs/remotes/origin/master

Any ideas?

Discount submodule

Currently updating discount dirties up the tree pretty badly. Can we either change it to be a real submodule (now that git submodules are friendlier) or add it to the .gitignore?

Please +1 👍 if you agree. I'm hoping to generate conversation that will eventually result in cleaning up the git status output.

@toland I'm very curious if you still stand by your original idea of making it a fake submodule.

Quotes preceded by spaces are not formatted as quotes

Self-explanatory text snipped formatted with markdown

----start

This is a normal paragraph.

This is a quote

Here is a list:

  • This is a list item.

This is a quote insde a list item.


This is a normal paragraph.

This is a quote

Here is a list:

  • This is a list item.

This is a quote insde a list item.

----eof

The second set of quotes is not rendered as quotes, and the > character gets rendered (which should not).

Gruberg formats his quotes preceded by spaces, as can be seen for example in http://daringfireball.net/2009/05/verizon_iphone_rumors.text, and his Markdown Dingus do render them as quotes, so I guess it's on specs.

Doesn't work when MultiMarkdown is installed

Hi guys,

I just stumbled across this issue and have a fix for it. However I have no idea how to push pull request, so here it is in plain text.

In Info.plist add <string>net.multimarkdown.text</string> to the LSItemContentTypes array.

So:

        <array>
            <string>net.daringfireball.markdown</string>
            <string>org.vim.markdown-file</string>
        </array>

Becomes:

        <array>
            <string>net.daringfireball.markdown</string>
            <string>net.multimarkdown.text</string>
            <string>org.vim.markdown-file</string>
        </array>

<hr> breaks code-block

<hr> breaks code blocks

Input:

#### Code

This is using markdown mixed with HTML.

```markdown
footnotes<sup>[1](#1)</sup>
```

And in your Footnotes section


```markdown
<hr />
###### Footnotes:
1. <a name="1">*Lorem Ipsum*</a>
```

Result:

image

Expected Result:

Code

This is using markdown mixed with HTML.

footnotes<sup>[1](#1)</sup>

And in your Footnotes section

<hr />
###### Footnotes:
1. <a name="1">*Lorem Ipsum*</a>

Conflict with UTI declaration when MacVim is installed

When MacVim is installed it registers an org.vim.markdown-file UTI to handle .markdown filename extension (not net.daringfireball.markdown). Subsequently the system treats .markdown files as that, which breaks QLMarkdown for these files (the system Text.qlgenerator is getting the files instead).
Can easily be fixed by appending the above UTI to LSItemContentTypes in the bundle's Info.plist.

Bug originally noticed when installing QLColorCode [http://code.google.com/p/qlcolorcode/issues/detail?id=50] and traced back here with the help of the person responsible for it. He also says that only public.plain-text is necessary in the UTTypeConformsTo section of the Info.plist.

Readme not complete.

Dear Philip,

thank you for qlmarkdown. I would like to use it but I seem to be too dumb to install it. The readme.markdown tells me that I should copy directory QLMarkdown.qlgenerator into ~/Library/QuickLook, but QLMarkdown.qlgenerator does not exist in the repository, It seems that I should compile something but I have no idea how to do that. Would it be an idea eg. to provide a link to an explanation of how to compile things like qlmarkdown?

Thanks,

Paul Huygen

support for .mmd multimarkdown extension please

hi, could you also add support for mmd files?
cheers! jens-a-e

diff --git a/Info.plist b/Info.plist
index fcf8426..7cc5cb2 100644
--- a/Info.plist
+++ b/Info.plist
@@ -27,6 +27,8 @@
           <string>mdml</string>
           <string>text</string>
           <string>mdwn</string>
+          <string>mmd</string>
+          <string>multimarkdown</string>
         </array>
       </dict>
     </dict>

Readme might be misleading

I attempted to run

./discount-config/update-discount.sh

as per the readme and it failed with:

./discount-config/update-discount.sh: line 17: ./update.sh: No such file or directory

However, the following worked:

cd ./discount-config
./update-discount.sh
cd ../

System Information

Mach kernel version:
Darwin Kernel Version 12.4.0: Wed May 1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64
Kernel configured for up to 8 processors.
4 processors are physically available.
8 processors are logically available.
Processor type: i486 (Intel 80486)
Processors active: 0 1 2 3 4 5 6 7
Primary memory available: 16.00 gigabytes
Default processor set: 161 tasks, 898 threads, 8 processors
Load average: 0.22, Mach factor: 7.77

zsh 4.3.11 (i386-apple-darwin12.0)

text not rendering in 10.12

I am finding that QuickLook is showing only the raw marked-up text and not the rendered html when using QLMarkdown in OS 10.12

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.