Former SNP leader Alex Salmond has resigned from the party amid sexual misconduct claims, which he denies.