Canon is a sanctioned or accepted group or body of related works. The Star Trek canon is generally defined as all released television series and feature films. The various "official" references (such as the Star Trek Encyclopedia or the Star Trek Chronology) may be used as a guide to canon information, but are not canon in and of themselves.
The definition of Star Trek canon may vary for different fans, and therefore for a reference source like Memory Alpha, the question may become especially difficult. The term fanon is used to refer to "fan canon", of which the term is a portmanteau. It applies to certain "facts" that may have been accepted as a truth by a large number of fans, and thus either replaces an established canonical fact in the minds of those fans, becoming retroactive continuity, or fills a plot-hole.
Listed below is the Core Canon listed in order of preferance.
Television Canon, refers to the canon level comprising the television shows, Star Trek (TOS), Star Trek: The Next Generation (TNG), Star Trek: Deep Space Nine (DS9), Star Trek: Voyager (VOY), Enterprise and Star Trek: Enterprise (ENT), Star Trek: Discovery (DIS), Star Trek: Picard (PIC), and Star Trek: Strange New Worlds (SNW).
Film Canon, referes to the canon level comprising of the movies, of Star Trek: The Motion Picture, Star Trek II: The Wrath of Kahn, Star Trek III: The Search for Spock, Star Trek IV: The Voyage Home, Star Trek V: The Final Frontier, Star Trek VI: The Undiscovered Country, Star Trek: Generations, Star Trek: First Contact, Star Trek: Insurrection, Star Trek: Nemesis, Star Trek, Star Trek: Into Darkness, Star Trek: Beyond, and Star Trek 4 (Untitled).
Animated Canon, refers to the canon level comprising the animated television shows, Star Trek: The Animated Series (TAS), Star Trek: Lower Decks (LD), and Star Trek: Prodigy (PRO).
Continuity Canon, consisting of all recent works (and many older works) released under the name of Star Trek: books, comics, games, and more. Games are a special case, as generally only the stories were C-canon, while things like stats and gameplay may not have been; they also offered non-canonical options to the player, such as choosing female gender for a canonically male character. C-canon elements have appeared in many of the above canon classifications.
Secondary Canon; the materials were available to be used or ignored as needed by authors. This included mostly older works, such as many of the Star Trek comics, that predated a consistent effort to maintain continuity; it also contained certain elements of a few otherwise N-canon stories, and other things that "may not fit just right." Many formerly S-canon elements were elevated to C-canon through their inclusion in more recent works by continuity-minded authors, while many other older works are accounted for in continuity from the start despite their age, and thus were always C-canon.
Non-Canon. What-if stories and anything else directly and irreconcilably contradicted by higher canon ended up here. N was the only level that is not considered canon. Information cut from canon, deleted scenes, or canceled Star Trek works fell into this category as well, unless another canonical work referenced it and it was declared canon.