Jump to content

Large Type treats \n as regular character


Recommended Posts

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

Link to comment
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.

Link to comment

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.

Link to comment
  • 2 months later...
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!

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