Suppose the required maximum number is $f(n)$
Any triangle gives us $f(3)=3$.
A slightly deformed regular polygon gives $f(n)=n$ for $n>4$. Another creative construction I saw was taking a lot of isolated triangles for $n=3k$, having two extra points form a very small angle with one of the triangle vertices to get $n=3k+2$, and having one extra point very close to the joining line of two vertices from different triangles to get $n=3k+1$.
$f(4)=3$ has a convulated official proof, but it is easy to simplify once you recognize that both cases essentially deal with the area. A simple proof: suppose we have points $A, B, C, D$, and WLOG $ABC$ is the triangle with smallest area among the 4 possible (since distances from a line to points is unique, the smallest area triangle is also unique). Then $D$ cannot be marked. (QED)