Jump to content

Large Type treats \n as regular character


Recommended Posts

Posted

Hello,

I write my workflow with node.js.
I return to Alfred a string like this 'first \n second' and I figured it should be printed like this:
'first
second'
but it prints verbatim as 'first \n second'

I think this issue is related to displaying the value (e.g. when I do console.log in nodejs I do receive it as expected),
and thus I would expect it to be a feature of Large Type.
I don't mind doing this conversion in node.js if anyone knows how? (silly, but couldn't find how to do it)

Thanks

Posted
4 hours ago, Tom6 said:

I return to Alfred a string like this 'first \n second' and I figured it should be printed like this:
'first
second'
but it prints verbatim as 'first \n second'

 

Alfred is behaving correctly. Backslash escapes are conveniences for source code or encoding. They aren't processed in input from other software because it then becomes impossible to pass the literal \n around.

 

You should be returning a real linebreak from your script.

 

If you'd like concrete help, please upload your workflow somewhere (Dropbox?) and post a link, so we can have a look ourselves. It's almost impossible to help someone fix a workflow you've never seen.

Posted

Thank you for verifying this!

Do you know how can I return a 'real' line break from node.js? I tried searching online but couldn't find it
I'm using in node.js the alfy.output('text here') extension
 

Posted

Like I said, I can’t really help you without seeing the workflow. Only guess.

 

As far as I know (and I’ve never written a workflow using Alfy or Node), alfy.output() is only for Script Filters. It outputs JSON, not text, which is why you’re getting \n.

 

console.log() should write the text correctly to STDOUT.

  • 2 months later...
Posted
On 2/8/2020 at 1:11 AM, deanishe said:

Like I said, I can’t really help you without seeing the workflow. Only guess.

 

As far as I know (and I’ve never written a workflow using Alfy or Node), alfy.output() is only for Script Filters. It outputs JSON, not text, which is why you’re getting \n.

 

console.log() should write the text correctly to STDOUT.

console.log() indeed solved my problem. Thanks!

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...