Former Scottish first minister Alex Salmond has resigned from the Scottish National Party days after he faced allegations of misconduct, prompting him to take action in court against the administration he once ran.