In fiction, canon is the material accepted as officially part of the story in an individual universe of that story. It is often contrasted with, or used as the basis for, works of fan fiction. The alternative terms mythology, timeline, and continuity are often used, with the former being especially to refer to a richly detailed fictional canon requiring a large degree of suspension of disbelief (e.g. an entire imaginary world and history), while the latter two typically refer to a single arc where all events are directly connected chronologically. Other times, the word can mean "to be acknowledged by the creator(s)."
The use of the word "canon" in reference to a set of texts derives from Biblical canon, the set of books regarded as scripture, as contrasted with non-canonical Apocrypha. The term was first used by analogy in the context of fiction to refer to the Sherlock Holmes stories and novels, written by Sir Arthur Conan Doyle.
The term "canon" nowadays refers to all works of fiction within a franchise's fictional universe which are considered "to have actually happened" within the fictional universe they belong to.
When there are multiple "official" works or original media, the question of what is and what is not canonical can be unclear. This is resolved either by explicitly excluding certain media from the status of canon (as in the case of Star Trek and Star Wars), by assigning different levels of canonicity to different media (as was in the case of Star Wars before the franchise was purchased by Disney), by considering different but licensed media treatments official and equally canonical to the series timeline within their own continuities universe, but not across them, or not resolved at all. The use of canon is of particular importance with regard to reboots or re-imaginings of established franchises, such as the 2009 Star Trek film, because of the ways in which it influences the viewer experience.
The official Star Trek website describes Star Trek canon as "the events that take place within the episodes and movies" (that is, the television series Star Trek: The Original Series, Star Trek: The Next Generation, Star Trek: Deep Space Nine, Star Trek: Voyager, Star Trek: Enterprise, and the Star Trek motion pictures). Events, characters and story lines from tie-in novels, comic books, and video games are explicitly excluded from the Star Trek canon, but the site notes that elements from these sources have been subsequently introduced into the television series, and says that "canon is not something set in stone." One example of a non-canonical element that later became canonical in the Star Trek universe was the name "Tiberius" becoming the official middle name of Enterprise captain James T. Kirk. The name was introduced in the Star Trek animated series, and was later added into the official biography of the character by its mention in the live-action film Star Trek VI: The Undiscovered Country.