Macdonald formula for curves with planar singularities