If I'm correct, those only happen on specific places of the cliff right, you can't jump from any cliff (for example on the second picture, only the edge on top of the square where Link actually is can be jumped from, no other part (darkened) of the cliff, right ?)
A possibility is to have an invisible sprite to act as a "way" on top of the ledge to act as "possibility trigger".
When Link is overlapping the blue box/trigger and actually moving at a greater Y than the bottom of the box, it is considered that the jump is effective.
From there, you ignore the player's inputs, and actually move Link by yourself down the yellow arrow for X pixels (the amount can be an instance variable of the blue block).
Once the amount of pixels travelled, you give back the hand to the player and "situates" back the character in the world where it should be (that is to say, down at the foot of the cliff, on a new layer likely. The next layer name can also be an instance variable in the blue rectangle.)