How to correctly use pathfinder for 2d platform enemies?

Pathfinding finds the shortest route between object and target and ideally works for top down games, where gravity isn’t a consideration.

When your player is up in the air, the shortest route from the enemy is a line into the air; it’s not along the platform.

Here’s an old thread in which the OP briefly explains a way to get around by using invisible pathfinding obstacles that prevents the enemy from rising into the air.