Git Product home page Git Product logo

Comments (15)

balthisar avatar balthisar commented on July 17, 2024 1

I could help take a look at this. As-is if I (for example) try to drag an image while allowing any file, it shows an appropriate warning (unable to parse the file).

To be more fancy you could tweak the CFBundleDocumentTypes entry to allow other extensions (pretty much any text extension might be acceptable; plain text is valid markdown for the most part).

I notice right now the existing entry uses CFBundleTypeOSTypes which is, while not officially deprecated, not all that useful for modern text files, especially in that it's allowing ????. Types and creators have been deprecated since 10.6 and are no longer even considered on the current deployment target.

The "modern" replacement is LSItemContentTypes which uses UTI's instead of type-creator codes.

Then it's a decision on which UTI's to support. Using public.txt should be almost automatic. There's still the problem of the markdown engine trying to parse non-markdown, but again, that's not a bad thing. Most plain text will render just fine. Some of the other system defined UTIs might be candidates, too.

John Gruber has even indicated a preferred UTI for Markdown (UTIs aren't limited to Apple's system UTIs).

net.daringfireball.markdown, which conforms to public.plain-text. The encoding should always be UTF-8.

So there's good support for arguing public.plain-text in addition to public.txt that I mentioned.

from markoff.

balthisar avatar balthisar commented on July 17, 2024

+1, would be good fix.

from markoff.

balthisar avatar balthisar commented on July 17, 2024

Quick fix is in #20 and will allow attempting to open any arbitrary filetype.

from markoff.

kaishin avatar kaishin commented on July 17, 2024

@sharplet What would you expect when opening a .txt file? Be treated as if it was a Markdown file?

from markoff.

sharplet avatar sharplet commented on July 17, 2024

Yes, more or less. I find it doesn't matter if it's not actually a markdown file and produces strange markup. It's helpful to have the flexibility to preview any plain text file.

from markoff.

balthisar avatar balthisar commented on July 17, 2024

Lots of markdown files have other extensions, e.g., chained through other processors. For example my file.html.md.erb is a typical static site generator markdown file.

from markoff.

kaishin avatar kaishin commented on July 17, 2024

@balthisar I have concerns about allowing any extension though. Will force us to handle errors and whatnot and it's not user-friendly when all files can be opened but only few will yield results.

from markoff.

vcavallo avatar vcavallo commented on July 17, 2024

+1 The files in which I use markdown syntax are often .txt. For my (and I imagine many people's) workflows it makes the most sense to keep plain text in txt format and then let the context in which it's being used dictate how it should be rendered. (now I'm wondering why I use any extension at all...)
The whole advantage of markdown is that I can use its syntax in non-fancy plain text files without any special handling and the syntax itself communicates the markup's intention - the markdown processors I look at them with are just a luxury.

from markoff.

nickdunn avatar nickdunn commented on July 17, 2024

I also hit this problem when trying to open Markdown files from Jekyll that I save as .md.erb because I process some dynamic snippets within the file.

from markoff.

vcavallo avatar vcavallo commented on July 17, 2024

@nickdunn Have you opened up those .md.erb files in any other markdown previewer? Like Mou or something?

from markoff.

nickdunn avatar nickdunn commented on July 17, 2024

Yes, fine in Mou. They are just markdown (with a tiny bit of embedded ruby) but saved as .erb so Markoff doesn't recognise them.

from markoff.

vcavallo avatar vcavallo commented on July 17, 2024

How do the Ruby code and erb tags look in the markdown? Like like plain
text? I don't have any similar files handy to look at myself but I'd assume
there would be some weirdness with the erb code not being fenced or
back-ticked and the characters being used by the markdown processor
erroneously.
On Fri, Mar 11, 2016 at 9:49 AM Nick Dunn [email protected] wrote:

Yes, they are just markdown (with a tiny bit of embedded ruby) but saved
as .erb.


Reply to this email directly or view it on GitHub
#4 (comment).

Vinney Cavallo http://vinneycavallo.com/

from markoff.

nickdunn avatar nickdunn commented on July 17, 2024

Something simple like:

Here is a paragraph.

<% code('js') do %>
var expect = chai.expect;
<% end %>

Here is another paragraph.

Markoff renders the ERB as plain text as expected in this example. I'm not expecting Markoff to deal with this gracefully, but I'd like to be able to view the file as-is while editing the plain text parts.

from markoff.

vcavallo avatar vcavallo commented on July 17, 2024

I absolutely agree. Sorry for the tangent :)

On Fri, Mar 11, 2016 at 9:55 AM Nick Dunn [email protected] wrote:

Something simply like:

Here is a paragraph.

<% code('js') do %>
Here is some JavaScript
<% end %>

Here is another paragraph.

Markoff renders the ERB as plain text as expected in this example. I'm not
expecting Markoff to deal with this gracefully, but I'd like to be able to
view the file as-is while editing the plain text parts.


Reply to this email directly or view it on GitHub
#4 (comment).

Vinney Cavallo http://vinneycavallo.com/

from markoff.

vcavallo avatar vcavallo commented on July 17, 2024

:)

from markoff.

Related Issues (20)

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.