Command Line "Save As" Support, Search HTML Source

Joshua Wright's Avatar

Joshua Wright

28 Jun, 2018 12:22 PM

Marked 2 has become an indispensable tool in my everyday writing. There are a few additional features that I'd love to see:

  1. I regularly open 40 or so Markdown files and export as HTML. It would be fantastic if this were a command line option that I could automate.
  2. I use the Switch to HTML Source View often to identify HREF tags when linking to sections within a markdown document. If I press Cmd+F to search the HTML source, Marked 2 switched back to the preview mode instead of letting me search the HTML source. Is it possible to preserve the current view mode for search?

Thank you!

-Josh

  1. Support Staff 1 Posted by Brett on 28 Jun, 2018 01:08 PM

    Brett's Avatar

    These are both nearly impossible at this point. To do anything beyond
    what you can already do with command line tools (like multimarkdown,
    kramdown, discount, pandoc, etc.) Marked has to load a web view. I could
    have a headless browser, but at that point I'm still replicating
    features that most of the existing command line tools can already pull
    off.

    Search in Marked is complex, and it's built around the web view (it runs
    via JavaScript and HTML). It might be possible to offer a second search
    for the source tab, but reworking that isn't in my current roadmap. I
    can consider it for a future update, though.

    -Brett

  2. 2 Posted by Joshua Wright on 29 Jun, 2018 01:42 PM

    Joshua Wright's Avatar

    Thanks for the note Brett. If command line isn't an option, how about some other automation like AppleScript support?

    I'm new to AppleScript, but this looks like it should open and save the file as HTML (my intended target):

    tell application "Marked 2"
        activate
        open POSIX file "/Users/jwright/1.1.md"
        save document 1 in file "/Users/jwright/1.1.html" as "HTML"
    end tell
    

    However I get an error from Marked 2:

    error "Marked 2 got an error: The document cannot be exported to the \"HTML\" format." number -50

    Is that a better option for automation instead of command line services?

    Thanks!

    -Josh

  3. Support Staff 3 Posted by Brett on 29 Jun, 2018 08:27 PM

    Brett's Avatar

    Marked currently has no true AppleScript library, it only implements
    "Open". I've focused mostly on the URL handler, but it only covers
    preview features, not export. Export automation is something I do intend
    to expand on, but at present it's not really there at all.

    -Brett

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac