HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URL's added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
-
const json = `
{
"@context": "https://schema.org",
"@type": "TVSeries",
"name": "Star Trek: Short Treks",
"containsSeason": [
{
"@type": "TVSeason",
"seasonNumber": 1,
"episode": [
{
"@type": "Episode",
"episodeNumber": "S1:E1",
"name": "Runaway",
"datePublished": "2018-10-04",
"workTranslation": {
"@type": "Episode",
"name": " Runaway",
"alternateName": "Entlaufen",
"inLanguage": "de",
"datePublished": "2019-01-17"
},
"director": {
"@id": "#MajaVrvilo",
"@type": "Person",
"name": "Maja Vrvilo"
},
"abstract": "Sylvia Tilly entdeckt eine blinde Passagierin und findet heraus, dass diese eine flüchtige Königin ist."
},
{
"@type": "Episode",
"episodeNumber": "S1:E2",
"name": "Calypso",
"datePublished": "2018-11-08",
"workTranslation": {
"@type": "Episode",
"name": " Calypso",
"inLanguage": "de",
"datePublished": "2019-01-17"
},
"director": {
"@id": "#OlatundeOsunsanmi",
"@type": "Person",
"name": "Olatunde Osunsanmi"
},
"abstract": "Der autonom weiterentwickelte Schiffscomputer der Discovery rettet den Soldaten Craft 1000 Jahre nach der Serie aus einer Rettungskapsel. Zora, die künstliche Intelligenz der Discovery, beginnt sich in Craft zu verlieben, lässt ihn am Ende jedoch zu seinem Heimatplaneten aufbrechen."
},
{
"@type": "Episode",
"episodeNumber": "S1:E3",
"name": "The Brightest Star",
"datePublished": "2018-12-06",
"workTranslation": {
"@type": "Episode",
"name": " The Brightest Star",
"alternateName": "Der hellste Stern",
"inLanguage": "de",
"datePublished": "2019-01-17"
},
"director": {
"@id": "#DouglasAarniokoski",
"@type": "Person",
"name": "Douglas Aarniokoski"
},
"abstract": "Saru findet auf seiner Heimatwelt ein defektes Kommunikationsgerät und kann es reparieren. So kommt er als erster Kelpianer zur Föderation. "
},
{
"@type": "Episode",
"episodeNumber": "S1:E4",
"name": "The Escape Artist",
"datePublished": "2019-01-03",
"workTranslation": {
"@type": "Episode",
"name": "Houdini",
"inLanguage": "de",
"datePublished": "2019-01-17"
},
"director": {
"@id": "#RainnWilson",
"@type": "Person",
"name": "Rainn Wilson"
},
"abstract": "Harry Mudd ist einem Kopfgeldjäger in die Hände gefallen, der ihn an die Föderation ausliefern will."
}
]
},
{
"@type": "TVSeason",
"seasonNumber": 2,
"episode": [
{
"@type": "Episode",
"episodeNumber": "S2:E1",
"name": "Q&A",
"datePublished": "2019-10-05",
"director": {
"@id": "#MarkPellington",
"@type": "Person",
"name": "Mark Pellington"
},
"abstract": "Spock hat seinen ersten Tag auf der Enterprise. Er bleibt mit Nummer Eins im Turbolift stecken."
},
{
"@type": "Episode",
"episodeNumber": "S2:E2",
"name": "The Trouble with Edward",
"datePublished": "2019-10-10",
"director": {
"@id": "#DanielGrayLongino",
"@type": "Person",
"name": "Daniel Gray Longino"
},
"abstract": "Lynne Lucero übernimmt ihr erstes Kommando. Dort trifft sie auf Edward Larkin."
},
{
"@type": "Episode",
"episodeNumber": "S2:E3",
"name": "Ask Not",
"datePublished": "2019-11-14",
"director": {
"@id": "#SanjiSenaka",
"@type": "Person",
"name": "Sanji Senaka"
},
"abstract": "Als Sternenbasis 28 angegriffen wird, kümmert sich Kadett Thira Sidhu um einen meuternden Gefangenen: Kapitän Christopher Pike von der Enterprise. Pike versucht Sidhu unter Druck zu setzen, ihn freizulassen, aber sie lehnt ab. Pike enthüllt, dass dies ein simulierter Test ist, und bei Bestehen wird Sidhu als Teil der Enterprise-Crew akzeptiert."
},
{
"@type": "Episode",
"episodeNumber": "S2:E4",
"name": "Ephraim and Dot",
"datePublished": "2019-12-12",
"director": {
"@id": "#MichaelGiacchino",
"@type": "Person",
"name": "Michael Giacchino"
},
"abstract": "Ein weibliches Bärtierchen, das nach einem Ort sucht, an dem es seine Eier ablegen kann, kreuzt den Weg der USS Enterprise und wird von einer Reparaturdrohne namens Dot angegriffen."
},
{
"@type": "Episode",
"episodeNumber": "S2:E5",
"name": "The Girl Who Made the Stars",
"datePublished": "2019-12-12",
"director": {
"@id": "#OlatundeOsunsanmi",
"@type": "Person",
"name": "Olatunde Osunsanmi"
},
"abstract": "Die kleine Michael Burnham wacht in der Nacht auf. Um sie zu beruhigen, erzählt ihr Vater ihr eine Geschichte eines afrikanischen Stammes."
},
{
"@type": "Episode",
"episodeNumber": "S2:E6",
"name": "Children of Mars",
"datePublished": "2020-01-09",
"workTranslation": {
"@type": "Episode",
"name": "Kinder des Mars",
"inLanguage": "de",
"datePublished": "2021-01-14"
},
"director": {
"@id": "#MarkPellington",
"@type": "Person",
"name": "Mark Pellington"
},
"abstract": "Die Folge handelt von zwei Schülerinnen, deren Eltern auf dem Mars arbeiten. Die beiden drangsalieren sich, was in einer Prügelei endet. Kurz darauf erfahren alle Lehrer und Schüler von einem Angriff auf den Mars."
}
]
}
]
}
`;
- const isDirectorVisible = false;
- const isWorkTranslationDatePublishedVisible = false;
- const data = JSON.parse(json);
table(lang=data.inLanguage, typeof=data['@type'], vocab=data['@context']['@vocab']||data['@context'])
caption= data.name
each season in data.containsSeason
tbody(property="containsSeason", typeof=season['@type'])
each episode in season.episode
tr(property="episode", typeof=episode['@type'])
th(property="episodeNumber")= episode.episodeNumber
td(property="name")= episode.name
if episode.workTranslation
td(property="workTranslation", typeof=episode.workTranslation['@type'], lang=episode.workTranslation.inLanguage, resource=`_:${episode.episodeNumber}@${episode.workTranslation.inLanguage}`)
span(property="name")= episode.workTranslation.name
if episode.workTranslation.alternateName
| /
span(property="alternateName")= episode.workTranslation.alternateName
else
td
td
time(property="datePublished")= episode.datePublished
if isWorkTranslationDatePublishedVisible
if episode.workTranslation
td(resource=`_:${episode.episodeNumber}@${episode.workTranslation.inLanguage}`)
time(property="datePublished")= episode.workTranslation.datePublished
else
td
if isDirectorVisible
td(property="director", typeof=episode.director['@type'], resource=`https://bittersmann.de/startrek/persons${episode.director['@id']}`)
span(property="name")= episode.director.name
if episode.abstract
td
details
summary Synopsis
p(property="abstract", lang="de")= episode.abstract
else
td
Also see: Tab Triggers