Jump to content

MarkdownTransform — Convert Markdown to other formats


Recommended Posts

2 hours ago, vitor said:

Should now work with system ruby.

 

Nice.

 

I spent way too long trying to figure out why it wasn't working on my second machine. I spent ages looking for conflicting hotkeys till I finally realised I hadn't installed a Homebrew Ruby on that machine.

Link to comment
1 hour ago, deanishe said:

A minor thing: your exported workflows contain all the weird ._ macOS metadata files.

 

Crap. It’s the ditto command (we need to tell it to not save those), which means this isn’t the only Workflow like that. I’ll have to fix them all (faster than checking one by one), but I’m not sure if it’s worth it to make new releases or if I might just overwrite the current versions.

Link to comment
10 hours ago, deanishe said:

Unless you can replace them all with one command.

 

I can. The Github repo is basically

WorkflowName
├─ README.md 
├─ WorkflowName.alfredworkflow
└─ source
   └─ … (the unpacked Workflow)

repeated for each Workflow. So a simple script should handle it.

Link to comment
On 20/12/2017 at 2:28 AM, vitor said:

Update.


Should now work with system ruby.


To update, download the latest version (same URL) or wait a few days and it’ll prompt you to on next usage, since it uses OneUpdater.

 

Great (though in the meantime I made my own workflow that uses Pandoc with a custom Lua writer)! Out of curiosity and desire to learn, how did you get this to work?

 

Thanks again for your excellent workflows!

Link to comment
On 26/12/2017 at 3:28 AM, iandol said:

though in the meantime I made my own workflow that uses Pandoc with a custom Lua writer

 

I remember looking at Pandoc when I decided to go from my own script to a library, but ultimately decided against it because it looked like it’d be a much greater pain to bundle in the Workflow. But it also weighted in choosing Redcarpet that it was what Github used to use and I mostly use GHFM.

 

On 26/12/2017 at 3:28 AM, iandol said:

Out of curiosity and desire to learn, how did you get this to work?

 

I don’t remember exactly what I was looking at, but it was a different issue with this Workflow and I noticed that the gem might’ve been installed with the gem command from the updated install /usr/local/bin/gem instead of the system one /usr/bin/gem. Usually that doesn’t make a difference, but clearly it does in this case and I must’ve forgotten to test before.

 

On 26/12/2017 at 3:28 AM, iandol said:

Thanks again for your excellent workflows!

 

Thank you for the kind words.

 

On 26/12/2017 at 10:38 AM, deanishe said:

Back on Vítor's now because the output from his is much prettier

 

Being a designer concerned with correct typesetting has to be good for something!

 

On 26/12/2017 at 10:38 AM, deanishe said:

and it handles the buggy editor on the forum better.

 

It helps that I’ve designed it specifically for this forum. There’s a good chance it might look a bit off in other forums. But this is the only forum I frequently frequent, and I’d bet that’s true for most of us regulars.

Link to comment
5 hours ago, vitor said:

it looked like it’d be a much greater pain to bundle in the Workflow

 

Definitely. Pandoc is massive.

 

5 hours ago, vitor said:

Being a designer concerned with correct typesetting has to be good for something!

 

Making pretty stuff!

 

5 hours ago, vitor said:

There’s a good chance it might look a bit off in other forums.

 

It does, but no biggie. Most of the other places I post support Markdown or I don't post code there. The support for code in Markdown and your workflow is why it's so damn handy here.

Link to comment

@vitor ...yes, Pandoc cannot be easily bundled: it is ~100MB, and for generic BBCode conversion would be pure overkill!!! But I use it for all my writing (triggered via Scrivener 3) and it is incredibly powerful for multiple output formats, so it was easy to make a personal workflow with a custom Lua writer with it.

 

Thanks for the technical details on the fix!

Link to comment

Hi Vitor,

 

I have been trying to use MarkdownTransform recently as I really like the concept of it. (I am using Pandoc extensively).

 

I understand that RedCarpet needs some specific Ruby installation but, reading through this set of posts, it seems that the latest versions of MarkdownTransform would also work with the default Ruby installation ("should now work with system ruby") on High Sierra (let me know if I am wrong). However, for me, this doesn't seem to work.

 

I understand that I can install the latest version of ruby using homebrew, but would prefer, if at all possible, to not have to install another version of ruby alongside of the High Sierra installed one.

 

Here is what I get when I try to use MarkdownTransform to produce some RTF from a markdown text copied in the clipboard:

 

Starting debug for 'MarkdownTransform'
[2018-01-03 08:42:18][ERROR: action.script] /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/Users/username/Desktop/Dropbox/Alfred3_Sync_Folder/Alfred.alfredpreferences/workflows/user.workflow.1A72E7E5-AF98-4BB3-9C50-2E1BE8F769F2/_licensed/Redcarpet/gems/redcarpet-3.4.0/lib/redcarpet.bundle, 0x0009): required dylib '/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib' not found, needed by '/Users/username/Desktop/Dropbox/Alfred3_Sync_Folder/Alfred.alfredpreferences/workflows/user.workflow.1A72E7E5-AF98-4BB3-9C50-2E1BE8F769F2/_licensed/Redcarpet/gems/redcarpet-3.4.0/lib/redcarpet.bundle'.  Did try: file not found '/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib', file not found '/usr/lib/libruby.2.0.0.dylib', file not found '/usr/local/lib/libruby.2.0.0.dylib' - /Users/username/Desktop/Dropbox/Alfred3_Sync_Folder/Alfred.alfredpreferences/workflows/user.workflow.1A72E7E5-AF98-4BB3-9C50-2E1BE8F769F2/_licensed/Redcarpet/gems/redcarpet-3.4.0/lib/redcarpet.bundle (LoadError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/username/Desktop/Dropbox/Alfred3_Sync_Folder/Alfred.alfredpreferences/workflows/user.workflow.1A72E7E5-AF98-4BB3-9C50-2E1BE8F769F2/_licensed/Redcarpet/gems/redcarpet-3.4.0/lib/redcarpet.rb:1:in `<top (required)>'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from ./rtf:4:in `<main>'

Edited by Guy Stan
Link to comment
On 03/01/2018 at 8:48 AM, Guy Stan said:

MarkdownTransform to produce some RTF from a markdown text copied in the clipboard

 

MarkdownTransform acts on selected text, not text on the clipboard.


As for the error, do this in a terminal and try again:

mv "${HOME}/Desktop/Dropbox/Alfred3_Sync_Folder/Alfred.alfredpreferences/workflows/user.workflow.1A72E7E5-AF98-4BB3-9C50-2E1BE8F769F2/_licensed/Redcarpet" "${HOME}/.Trash"

/usr/bin/gem install --install-dir "${HOME}/Desktop/Dropbox/Alfred3_Sync_Folder/Alfred.alfredpreferences/workflows/user.workflow.1A72E7E5-AF98-4BB3-9C50-2E1BE8F769F2/_licensed/Redcarpet" --no-document redcarpet

Be careful with the command. It’s based on the output you gave me, so if you altered it in any way, you’ll need to take that into account.

Edited by vitor
Fixed missing slash
Link to comment
  • 2 weeks later...

Hi,

 

I'm new to Alfred. So this may be a silly questions / config thing, that is obvious and I am just missing it...

 

But, I cannot get this workflow to work. Here are (what I think to be) some of the relevant details:

 

Mac OSX 10.13.2

Ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]

Redcarpet 3.4.0

Alfred 3.5.1

MarkdownTransform v1.21.0

 

Here's what I've tried:

 

I select the text (the apps I have tried this in are Outlook 2016, and Word 2016). Use the allocated hotkey (I've tried various combinations). And nothing happens.

 

No doubt I'm doing something wrong. Any help would be greatly appreciated.

 

Thanks in advance,

Atanas.

Link to comment
8 minutes ago, vitor said:

@_atanas Open the debugger, set the log output to “All Information”, and post the output.

 

Thanks for your quick response @vitor. I get the below:

 

[2018-01-12 10:34:26][trigger.hotkey] Processing output of 'action.script' with arg 'this is normal text that is now *bold*, **italic**, and now ***bold-italics***. '
[2018-01-12 10:34:26][ERROR: action.script] /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': dlopen(/Users/atanasjanackovski/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C2D7D30E-F51F-489C-AB45-C098803A3AD0/_licensed/Redcarpet/gems/redcarpet-3.4.0/lib/redcarpet.bundle, 0x0009): required dylib '/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib' not found, needed by '/Users/atanasjanackovski/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C2D7D30E-F51F-489C-AB45-C098803A3AD0/_licensed/Redcarpet/gems/redcarpet-3.4.0/lib/redcarpet.bundle'.  Did try: file not found '/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/libruby.2.0.0.dylib', file not found '/usr/lib/libruby.2.0.0.dylib', file not found '/usr/local/lib/libruby.2.0.0.dylib' - /Users/atanasjanackovski/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C2D7D30E-F51F-489C-AB45-C098803A3AD0/_licensed/Redcarpet/gems/redcarpet-3.4.0/lib/redcarpet.bundle (LoadError)
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/atanasjanackovski/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C2D7D30E-F51F-489C-AB45-C098803A3AD0/_licensed/Redcarpet/gems/redcarpet-3.4.0/lib/redcarpet.rb:1:in `<top (required)>'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from ./rtf:4:in `<main>'
[2018-01-12 10:34:26][action.script] Processing output of 'output.dispatchkeycombo' with arg ''
[2018-01-12 10:34:26][output.dispatchkeycombo] Processing output of 'output.dispatchkeycombo' with arg ''
[2018-01-12 10:34:26][output.dispatchkeycombo] Processing output of 'action.script' with arg ''

 

Edited by _atanas
Link to comment

@_atanas Try this in a terminal:

mv '/Users/atanasjanackovski/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C2D7D30E-F51F-489C-AB45-C098803A3AD0/_licensed/Redcarpet' "${HOME}/.Trash"

/usr/bin/gem install --install-dir '/Users/atanasjanackovski/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C2D7D30E-F51F-489C-AB45-C098803A3AD0/_licensed/Redcarpet' --no-document redcarpet

The same caveat as before applies.

 

Since redcarpet seems to require rebuilding depending on the macOS version, I should integrate the fix into the Workflow.

Link to comment
20 minutes ago, vitor said:

@_atanas Try this in a terminal:


mv '/Users/atanasjanackovski/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C2D7D30E-F51F-489C-AB45-C098803A3AD0/_licensed/Redcarpet' "${HOME}/.Trash"

/usr/bin/gem install --install-dir '/Users/atanasjanackovski/Library/Application Support/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.C2D7D30E-F51F-489C-AB45-C098803A3AD0/_licensed/Redcarpet' --no-document redcarpet

The same caveat as before applies.

 

Since redcarpet seems to require rebuilding depending on the macOS version, I should integrate the fix into the Workflow.

 

@vitor that worked a treat, thanks. A question about redcarpet though, does this mean that I have two instances installed now?

 

BTW, this is a super workflow! Thanks!

Link to comment
15 minutes ago, _atanas said:

does this mean that I have two instances installed now?

 

Yes. One included and contained in the Workflow (so it doesn’t affect anything else) and the other one in your system. If you uninstall the one in your system, the Workflow will still work. If you remove the Workflow, no trace of its redcarpet will remain.

 

17 minutes ago, _atanas said:

BTW, this is a super workflow! Thanks!

 

Thank you for the kind words.

Link to comment
15 minutes ago, _atanas said:

is it possible to add superscript and subcript conversion for Markdown > RTF?

 

I wasn’t familiar with Markdown subscript. It seems like there may be only one flavour of Markdown that supports it, and it isn’t the one redcarpet uses. But in the RTF conversion you can always use <sub></sub>, and it’ll work.


As for superscript, coming right up.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...