Rule of Criminal Procedure 11

See Stormwind Rules of Criminal Procedure.

Rule 11. Criminal Contempt.
The magistrate may summarily punish a person who commits criminal contempt in his presence if the magistrate saw or heard the contemptuous conduct and so certifies. The contempt order must recite the facts, be signed by the magistrate, and be made public record.

Commentary
Yes, the magistrate can rule you in contempt if you act a fool in court.

No, the magistrate can't just do it without justifying it.

Yes, you can appeal.