Jump to content

use anchor-links / prevent ASCI-Encoding


Recommended Posts

I try to create a workflow, that lists search_results and opens the relevant gitlab-markdown script on select. Therefore I want to use link-anchors to jump to the correct section in the markdown file. Therefore I used something like:

 

wf.add_item(title=src['content'],
            icon=u'imgs/{}.png'.format(src['file'].split(".",1)[0]),
            subtitle=subtitle,
            arg='aws.md#s3',
            valid=True)

However my link aws.md#s3 gets replaced with the ASCI-Encoding (https://www.w3schools.com/tags/ref_urlencode.asp) when used by the "open url"-step, so in this case: aws.md%23s3. This format does not work on gitlab. How can I prevent the replacement of # with %23?

Edited by nikffm
Link to post

It has nothing to do with ASCII. Alfred is URL-encoding your arg, as it has no way of knowing whether your input is already correctly encoded or not.

 

The solution is to not use the Open URL action. Instead, use a normal Run Script action (Language = /bin/bash, with input as argv) with the following content:

open "$1"

Link to post

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