<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Kavya Sahai</title>
    <description>The latest articles on Forem by Kavya Sahai (@kavya-sahai-god).</description>
    <link>https://forem.com/kavya-sahai-god</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1256627%2F8456928e-c1b3-4d29-aa25-0e921ac4f783.jpeg</url>
      <title>Forem: Kavya Sahai</title>
      <link>https://forem.com/kavya-sahai-god</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/kavya-sahai-god"/>
    <language>en</language>
    <item>
      <title>[Boost]</title>
      <dc:creator>Kavya Sahai</dc:creator>
      <pubDate>Sun, 26 Jan 2025 09:19:47 +0000</pubDate>
      <link>https://forem.com/kavya-sahai-god/-5ah5</link>
      <guid>https://forem.com/kavya-sahai-god/-5ah5</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/kavya-sahai-god" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1256627%2F8456928e-c1b3-4d29-aa25-0e921ac4f783.jpeg" alt="kavya-sahai-god"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/kavya-sahai-god/creating-a-code-beautifier-2kko" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Programmers HATE This: How I Made A Code Beautifier Without Any Fancy Libraries!&lt;/h2&gt;
      &lt;h3&gt;Kavya Sahai ・ Jan 24&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#programming&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>[Boost]</title>
      <dc:creator>Kavya Sahai</dc:creator>
      <pubDate>Fri, 24 Jan 2025 17:29:45 +0000</pubDate>
      <link>https://forem.com/kavya-sahai-god/-5ahk</link>
      <guid>https://forem.com/kavya-sahai-god/-5ahk</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/kavya-sahai-god" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1256627%2F8456928e-c1b3-4d29-aa25-0e921ac4f783.jpeg" alt="kavya-sahai-god"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/kavya-sahai-god/creating-a-code-beautifier-2kko" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Creating a Code-beautifier&lt;/h2&gt;
      &lt;h3&gt;Kavya Sahai ・ Jan 24&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#programming&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>tooling</category>
    </item>
    <item>
      <title>Programmers HATE This: How I Made A Code Beautifier Without Any Fancy Libraries!</title>
      <dc:creator>Kavya Sahai</dc:creator>
      <pubDate>Fri, 24 Jan 2025 17:29:26 +0000</pubDate>
      <link>https://forem.com/kavya-sahai-god/creating-a-code-beautifier-2kko</link>
      <guid>https://forem.com/kavya-sahai-god/creating-a-code-beautifier-2kko</guid>
      <description>&lt;p&gt;Remember we're building a house. We'd need two main things: the structure (the HTML) and how it looks (the CSS), and some logic to handle stuff like what happens when you click buttons (the JavaScript). Today, the webpage we'll build does that for a simple "Code Beautifier" tool that formats code for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. &lt;code&gt;index.html&lt;/code&gt; - The Structure of the tool
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Code Beautifier&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"style.css"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;header&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/blog/"&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"text-decoration: none; color: inherit; transition: opacity 0.3s; opacity: 0.8; padding-right: 20px;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Learn HTML, CSS and JS for free&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;     
    &lt;span class="nt"&gt;&amp;lt;/header&amp;gt;&lt;/span&gt;
     &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"notification-container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt; Code Beautifier&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;textarea&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"code-input"&lt;/span&gt; &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"Paste your code here..."&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/textarea&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"button-container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"beautify-btn"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Beautify&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"minify-btn"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Minify&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"code-output-container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;pre&amp;gt;&amp;lt;code&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"code-output"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"copy-code-btn"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Copy&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"download-code-btn"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Download&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"script.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/code&gt;&lt;/strong&gt;: Remember from the previous post, this is like saying, "Hey browser, this is a webpage!" It's just a standard thing all webpages have.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;&amp;lt;html lang="en"&amp;gt;&lt;/code&gt;&lt;/strong&gt;: This is the root of the webpage.  &lt;code&gt;lang="en"&lt;/code&gt; means the main language is English(United States).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;&lt;/strong&gt;:  This part contains information about the webpage that isn't shown directly to the user, but important for SEO, we'll talk about it later

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;&amp;lt;meta charset="UTF-8"&amp;gt;&lt;/code&gt;&lt;/strong&gt;: This tells the browser how to handle text characters. Don't worry too much about it for now;&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;&amp;lt;meta name="viewport" ...&amp;gt;&lt;/code&gt;&lt;/strong&gt;: This helps the page look good on different devices (phones, tablets, computers).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;&amp;lt;title&amp;gt;Code Beautifier&amp;lt;/title&amp;gt;&lt;/code&gt;&lt;/strong&gt;: This is the text that appears in the browser tab, like a title for your webpage. For example, when one goes to &lt;code&gt;youtube.com&lt;/code&gt;, YouTube is the title of the homepage of site.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;&amp;lt;link rel="stylesheet" href="style.css"&amp;gt;&lt;/code&gt;&lt;/strong&gt;: This is where we'll link the stylesheet which is going to be used to define how the webpage looks.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;&lt;/strong&gt;:  This is the visible part of the webpage. This is where all the content that you see comes from&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;&amp;lt;header&amp;gt;&lt;/code&gt;&lt;/strong&gt;: This is like the top part of the page, often containing a title or logo, some also call it the &lt;code&gt;hero&lt;/code&gt; section, sound fancy, doesn't it?

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;&amp;lt;a href="/blog/" ...&amp;gt;Learn HTML, CSS and JS for free&amp;lt;/a&amp;gt;&lt;/code&gt;&lt;/strong&gt;: This is a link that says "Learn HTML, CSS and JS for free". It takes you to the blog if you click on it, try clicking on it over here: &lt;a href="https://web-dev-free.netlify.app/tools/code-beautifier/" rel="noopener noreferrer"&gt;Code Beautifier&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;   &lt;strong&gt;&lt;code&gt;&amp;lt;div id="notification-container"&amp;gt;&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/strong&gt;:  A container where notification messages will appear, like "Code copied" or "Error".&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;&amp;lt;div class="container"&amp;gt;&lt;/code&gt;&lt;/strong&gt;:  This is like a big box to hold the main content of the tool.

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;&amp;lt;h1&amp;gt; Code Beautifier&amp;lt;/h1&amp;gt;&lt;/code&gt;&lt;/strong&gt;:  This is the main heading, a big title on the page.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;&amp;lt;textarea id="code-input" ...&amp;gt;&amp;lt;/textarea&amp;gt;&lt;/code&gt;&lt;/strong&gt;: This is a big text box where you paste your code. The &lt;code&gt;placeholder&lt;/code&gt; text is what the user will see inside before you type.&lt;/li&gt;
&lt;li&gt;   &lt;strong&gt;&lt;code&gt;&amp;lt;div class="button-container"&amp;gt;&lt;/code&gt;&lt;/strong&gt;: A container to hold our buttons so we can style them together.

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;&amp;lt;button id="beautify-btn"&amp;gt;Beautify&amp;lt;/button&amp;gt;&lt;/code&gt;&lt;/strong&gt;:  A button that the user will click to make their code look nicer, we'll handle the logic of it later.&lt;/li&gt;
&lt;li&gt;   &lt;strong&gt;&lt;code&gt;&amp;lt;button id="minify-btn"&amp;gt;Minify&amp;lt;/button&amp;gt;&lt;/code&gt;&lt;/strong&gt;: A button you click to remove unnecessary spaces and make your code smaller, i.e, it will reduce redundancy.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;&amp;lt;div class="code-output-container"&amp;gt;&lt;/code&gt;&lt;/strong&gt;: This is like a container for the code to be displayed in.

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;&amp;lt;pre&amp;gt;&amp;lt;code id="code-output"&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/pre&amp;gt;&lt;/code&gt;&lt;/strong&gt;: This is where the processed code will show up. &lt;code&gt;pre&lt;/code&gt; preserves spacing, and &lt;code&gt;code&lt;/code&gt; makes it look like code.&lt;/li&gt;
&lt;li&gt;   &lt;strong&gt;&lt;code&gt;&amp;lt;button class="copy-code-btn"&amp;gt;Copy&amp;lt;/button&amp;gt;&lt;/code&gt;&lt;/strong&gt;: A button to copy the displayed code.&lt;/li&gt;
&lt;li&gt;   &lt;strong&gt;&lt;code&gt;&amp;lt;button class="download-code-btn"&amp;gt;Download&amp;lt;/button&amp;gt;&lt;/code&gt;&lt;/strong&gt;: A button to download the displayed code as a file.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;&amp;lt;script src="script.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/code&gt;&lt;/strong&gt;: This is how you link the JavaScript code to your HTML. This is where the logic of the tool comes from; always remember, html is a markup language and not a programming language.&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;So, in short, the &lt;code&gt;index.html&lt;/code&gt; file sets up all the pieces (like a text box, a title, buttons, and a place to show the results) that make up the &lt;code&gt;Code Beautifier&lt;/code&gt; webpage.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. &lt;code&gt;script.js&lt;/code&gt; - The Brains of the Tool
&lt;/h2&gt;

&lt;p&gt;This file makes the page interactive. It's what happens when you click the buttons!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;DOMContentLoaded&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;inputArea&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;code-input&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;outputArea&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;code-output&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;beautifyButton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;beautify-btn&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;minifyButton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;minify-btn&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;copyButtons&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.copy-code-btn&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;downloadButton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.download-code-btn&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;notificationContainer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;notification-container&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="nx"&gt;beautifyButton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;inputArea&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;language&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;detectLanguage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;formattedCode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="k"&gt;switch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;language&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="nx"&gt;formattedCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;beautifyHTML&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                 &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                 &lt;span class="nx"&gt;formattedCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;beautifyCSS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                 &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                 &lt;span class="nx"&gt;formattedCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;beautifyJSON&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                 &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;python&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                 &lt;span class="nx"&gt;formattedCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;beautifyPython&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                 &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nl"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="c1"&gt;// javascript&lt;/span&gt;
                &lt;span class="nx"&gt;formattedCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;beautifyCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="nx"&gt;outputArea&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;formattedCode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
         &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nf"&gt;showNotification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Error during beautifying.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="nx"&gt;minifyButton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
        &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;inputArea&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
          &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;language&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;detectLanguage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
          &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;minifiedCode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

           &lt;span class="k"&gt;switch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;language&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
               &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                 &lt;span class="nx"&gt;minifiedCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;minifyHTML&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                 &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                  &lt;span class="nx"&gt;minifiedCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;minifyCSS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                  &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                     &lt;span class="nx"&gt;minifiedCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;minifyJSON&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                     &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;python&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                   &lt;span class="nx"&gt;minifiedCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;minifyPython&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                     &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                &lt;span class="nl"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="c1"&gt;// javascript&lt;/span&gt;
                   &lt;span class="nx"&gt;minifiedCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;minifyCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
           &lt;span class="p"&gt;}&lt;/span&gt;
           &lt;span class="nx"&gt;outputArea&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;minifiedCode&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
       &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nf"&gt;showNotification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Error during minifying.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="nx"&gt;copyButtons&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
            &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;codeToCopy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;previousElementSibling&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;code&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="nf"&gt;copyCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;codeToCopy&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="nx"&gt;downloadButton&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;outputArea&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;language&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;detectLanguage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;inputArea&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;fileExtension&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
              &lt;span class="k"&gt;switch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;language&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
                  &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="nx"&gt;fileExtension&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                    &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                        &lt;span class="nx"&gt;fileExtension&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                        &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                   &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="nx"&gt;fileExtension&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                    &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                   &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;python&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="nx"&gt;fileExtension&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;py&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                    &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
                   &lt;span class="nl"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="nx"&gt;fileExtension&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;

            &lt;span class="nf"&gt;downloadCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;`code.&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;fileExtension&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nf"&gt;showNotification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Code downloaded successfully!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;success&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
             &lt;span class="nf"&gt;showNotification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Error during download.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
         &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

     &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;detectLanguage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trimStart&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

          &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;html&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)){&lt;/span&gt;
              &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                  &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
              &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;

              &lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/*&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;body&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;div&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)){&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;def &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;import &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;class &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;from &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;print(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;if &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;while &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;for &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;try &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;except &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;finally &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;with &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;return &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;raise &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;assert &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;break &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;continue &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;global &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;nonlocal &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;lambda &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;pass &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;del &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;yield &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;async &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;await &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)){&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;python&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;function &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;const &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;let &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;var &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;=&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;trimmedCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;function(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)){&lt;/span&gt;
              &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;javascript&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;javascript&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;beautifyCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;lines&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;indentLevel&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;beautifiedLines&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;

        &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;line&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;lines&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;line&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;endsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nx"&gt;beautifiedLines&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;  &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;repeat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;indentLevel&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;line&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                &lt;span class="nx"&gt;indentLevel&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;line&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;}&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nx"&gt;indentLevel&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;indentLevel&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                &lt;span class="nx"&gt;beautifiedLines&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;  &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;repeat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;indentLevel&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;line&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nx"&gt;beautifiedLines&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;  &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;repeat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;indentLevel&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;line&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;beautifiedLines&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;minifyCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;&lt;span class="sr"&gt;+/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

     &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;beautifyHTML&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&amp;gt;&amp;lt;/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&amp;lt;&lt;/span&gt;&lt;span class="se"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;.*&lt;/span&gt;&lt;span class="se"&gt;?)&lt;/span&gt;&lt;span class="sr"&gt;&amp;gt;/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;$1&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\n\s&lt;/span&gt;&lt;span class="sr"&gt;*&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sr"&gt;/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;


    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;minifyHTML&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;&lt;span class="sr"&gt;+&amp;lt;/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;&lt;span class="sr"&gt;+/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

     &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;beautifyCSS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\{&lt;/span&gt;&lt;span class="sr"&gt;/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;{&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;  &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\}&lt;/span&gt;&lt;span class="sr"&gt;/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/;/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;;&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;  &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\n\s&lt;/span&gt;&lt;span class="sr"&gt;*&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sr"&gt;/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;minifyCSS&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;&lt;span class="sr"&gt;+/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/{&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;&lt;span class="sr"&gt;+/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;{&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;&lt;span class="sr"&gt;+}/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;}&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/:&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;&lt;span class="sr"&gt;+/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/;&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;&lt;span class="sr"&gt;+/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
     &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;beautifyJSON&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;parsed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;parsed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                 &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
     &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;minifyJSON&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
         &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;&lt;span class="sr"&gt;+/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;beautifyPython&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/:&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;&lt;span class="sr"&gt;*&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sr"&gt;/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;    &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;(\n\s&lt;/span&gt;&lt;span class="sr"&gt;*&lt;/span&gt;&lt;span class="se"&gt;)?(&lt;/span&gt;&lt;span class="sr"&gt;def|class|for|if|while|with|try|except|finally&lt;/span&gt;&lt;span class="se"&gt;)\b&lt;/span&gt;&lt;span class="sr"&gt;/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;$2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\n\s&lt;/span&gt;&lt;span class="sr"&gt;*&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sr"&gt;/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
           &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;minifyPython&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="se"&gt;\s&lt;/span&gt;&lt;span class="sr"&gt;+/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;copyCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clipboard&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;writeText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                 &lt;span class="nf"&gt;showNotification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Code copied to clipboard!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;success&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="p"&gt;})&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                 &lt;span class="nf"&gt;showNotification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Failed to copy code.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
                &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Failed to copy text: &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;downloadCode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;blob&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Blob&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;code&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;text/plain&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createObjectURL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;blob&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;href&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;download&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;appendChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;revokeObjectURL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;showNotification&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;success&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;notification&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;div&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;notification&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;notification&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;notification&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;textContent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nx"&gt;notificationContainer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;appendChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;notification&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;notification&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;show&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;notification&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;show&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nx"&gt;notificationContainer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;notification&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
            &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;2000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;document.addEventListener('DOMContentLoaded', function() { ... });&lt;/code&gt;&lt;/strong&gt;: This is like saying, "Hey JavaScript, wait until the entire page is loaded before you start doing anything." This is to ensure that, our code, doesn't randomly change the entire page :D&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;const inputArea = document.getElementById('code-input');&lt;/code&gt;&lt;/strong&gt;:  This is how JavaScript finds the text box where you (the user will) paste code. It gets the element with the id &lt;code&gt;code-input&lt;/code&gt; that we defined in the HTML file. Similar lines grab the other HTML elements like the buttons and the area for the output.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;beautifyButton.addEventListener('click', function() { ... });&lt;/code&gt;&lt;/strong&gt;: This says, "When the 'Beautify' button is clicked, do this stuff inside the curly brackets &lt;code&gt;{}&lt;/code&gt;"

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;const code = inputArea.value;&lt;/code&gt;&lt;/strong&gt;:  Get the code from the text box.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;const language = detectLanguage(code);&lt;/code&gt;&lt;/strong&gt;: It tries to figure out what type of code you've pasted (HTML, CSS, JavaScript, etc).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;let formattedCode; switch (language) { ... }&lt;/code&gt;&lt;/strong&gt;: Depending on the code type, it does different things to "beautify" it. There are several beautify functions for different code languages such as &lt;code&gt;beautifyCode(code)&lt;/code&gt; for JavaScript, &lt;code&gt;beautifyHTML(code)&lt;/code&gt; for HTML, &lt;code&gt;beautifyCSS(code)&lt;/code&gt; for CSS, &lt;code&gt;beautifyJSON(code)&lt;/code&gt; for JSON and &lt;code&gt;beautifyPython(code)&lt;/code&gt; for Python&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;outputArea.textContent = formattedCode;&lt;/code&gt;&lt;/strong&gt;:  Put the formatted code in the output area.&lt;/li&gt;
&lt;li&gt;   &lt;strong&gt;&lt;code&gt;try{ ... } catch(error) { ... }&lt;/code&gt;&lt;/strong&gt;: This tries to run the beautify code and catches errors, showing an error message if something goes wrong.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;minifyButton.addEventListener('click', function() { ... });&lt;/code&gt;&lt;/strong&gt;: This works very similarly to beautify, but instead uses the &lt;code&gt;minify&lt;/code&gt; functions such as &lt;code&gt;minifyCode(code)&lt;/code&gt; for JavaScript, &lt;code&gt;minifyHTML(code)&lt;/code&gt; for HTML, &lt;code&gt;minifyCSS(code)&lt;/code&gt; for CSS, &lt;code&gt;minifyJSON(code)&lt;/code&gt; for JSON and &lt;code&gt;minifyPython(code)&lt;/code&gt; for Python. These remove extra spaces to make the code smaller.&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;copyButtons.forEach(button =&amp;gt; { ... });&lt;/code&gt;&lt;/strong&gt;:  This makes each copy button work. When clicked, it copies the text displayed next to the button.&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;downloadButton.addEventListener('click', function() { ... });&lt;/code&gt;&lt;/strong&gt;:  When the "Download" button is clicked, this downloads the formatted code as a file.&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;function detectLanguage(code) { ... }&lt;/code&gt;&lt;/strong&gt;:  A function that tries to figure out what kind of code was pasted in, by looking for keywords in it.&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;function beautifyCode(code) { ... }&lt;/code&gt;, &lt;code&gt;function minifyCode(code) { ... }&lt;/code&gt; etc&lt;/strong&gt; These functions contain the specific logic to format, each type of code. For example the &lt;code&gt;beautifyCode&lt;/code&gt; function will add indentation to Javascript code, and &lt;code&gt;minifyCode&lt;/code&gt; will remove the unnecessary spaces.&lt;/li&gt;

&lt;li&gt; &lt;strong&gt;&lt;code&gt;function copyCode(text) { ... }&lt;/code&gt;&lt;/strong&gt;: copies text to the clipboard using the browser's functionality&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;&lt;code&gt;function downloadCode(code, filename) { ... }&lt;/code&gt;&lt;/strong&gt;: creates a downloadable file in the browser, that the user can save&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;function showNotification(message, type = 'success') { ... }&lt;/code&gt;&lt;/strong&gt;: Displays a little notification on the screen to tell you what's happening.&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;In summary, &lt;code&gt;script.js&lt;/code&gt; makes the buttons work, grabs the code, formats it, and shows the results. It handles errors, copies, downloads, and gives you little feedback messages. It's the action part of your tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  How They Work Together
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;HTML builds the structure:&lt;/strong&gt; You create the text box, the buttons, and the output area in &lt;code&gt;index.html&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;CSS styles the look:&lt;/strong&gt; The CSS file (&lt;code&gt;style.css&lt;/code&gt;, not shown yet) makes the webpage look pretty.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;JavaScript adds interactivity:&lt;/strong&gt; &lt;code&gt;script.js&lt;/code&gt; makes the buttons work when you click them. It grabs the code you paste in, formats it, shows it to you, and enables you to copy or download it.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;style.css&lt;/code&gt;: The Style Guide for the Webpage
&lt;/h2&gt;

&lt;p&gt;CSS (Cascading Style Sheets) is like the stylist for your website. While HTML provides the structure (like the walls and rooms of a house), CSS is responsible for how everything looks: colors, fonts, sizes, layouts, and more.&lt;/p&gt;

&lt;h3&gt;
  
  
  Main CSS Concepts
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Selectors:&lt;/strong&gt; This is how you target specific elements in your HTML. Examples in this code include &lt;code&gt;body&lt;/code&gt;, &lt;code&gt;header&lt;/code&gt;, &lt;code&gt;h1&lt;/code&gt;, &lt;code&gt;textarea&lt;/code&gt;, &lt;code&gt;.container&lt;/code&gt; and &lt;code&gt;#notification-container&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Properties:&lt;/strong&gt; These are the things you want to change about the selected element, such as &lt;code&gt;color&lt;/code&gt;, &lt;code&gt;font-size&lt;/code&gt;, &lt;code&gt;background-color&lt;/code&gt; and &lt;code&gt;padding&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Values:&lt;/strong&gt;  These are the specific settings for each property. For instance, a &lt;code&gt;color&lt;/code&gt; property might have the value &lt;code&gt;red&lt;/code&gt; or &lt;code&gt;#ff0000&lt;/code&gt; (which is also red).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Units:&lt;/strong&gt; These are used for sizing like &lt;code&gt;px&lt;/code&gt; (pixels), &lt;code&gt;rem&lt;/code&gt; (relative to font-size), &lt;code&gt;em&lt;/code&gt; (relative to parent font-size) and &lt;code&gt;vh&lt;/code&gt; (viewport height).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Comments:&lt;/strong&gt; Lines starting with &lt;code&gt;/*&lt;/code&gt; and ending with &lt;code&gt;*/&lt;/code&gt; are ignored by the browser, used for comments and organization.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;The Box Model:&lt;/strong&gt; This is a fundamental CSS concept. Imagine each HTML element as a box, the box has the content, any padding, border and margin that it may have.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Walking Through the CSS Code
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* ===================================================================== Variables and Global Styles ===================================================================== */&lt;/span&gt;
&lt;span class="nd"&gt;:root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;--primary-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#6c63ff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--primary-color-light&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#857dff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--secondary-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#56ccf2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--secondary-color-light&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#72d4f5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#f5f7fa&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--text-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#2c3e50&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--text-color-light&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#47596a&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--card-background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#ffffff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--shadow-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="py"&gt;--code-background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#f7f7f7&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--border-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#e0e0e0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--border-color-light&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#e8e8e8&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--gradient-start&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#e1f5fe&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--gradient-end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#e3f2fd&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c"&gt;/* Typography */&lt;/span&gt;
  &lt;span class="py"&gt;--base-font&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"Roboto"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--heading-font&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"Montserrat"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--code-font&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"Fira Code"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;monospace&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c"&gt;/* Spacing */&lt;/span&gt;
  &lt;span class="py"&gt;--base-padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--small-padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2.2rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--tiny-padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.7rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c"&gt;/* Transitions */&lt;/span&gt;
  &lt;span class="py"&gt;--base-transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt; &lt;span class="n"&gt;ease-in-out&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--fast-transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.2s&lt;/span&gt; &lt;span class="n"&gt;ease-in-out&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="c"&gt;/* Shadows */&lt;/span&gt;
  &lt;span class="py"&gt;--shadow-sm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="m"&gt;4px&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--shadow-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="py"&gt;--shadow-md&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;4px&lt;/span&gt; &lt;span class="m"&gt;8px&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--shadow-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="py"&gt;--shadow-lg&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;8px&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--shadow-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;:root { ... }&lt;/code&gt;&lt;/strong&gt;: This selects the root of your document. Here you're defining &lt;em&gt;CSS variables&lt;/em&gt;, reusable values that you can use in your styles.

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;--primary-color: #6c63ff;&lt;/code&gt;: Defines a primary color.  The prefix &lt;code&gt;--&lt;/code&gt; makes it a CSS variable.  This color will be used for the main elements of the page&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;--base-font: "Roboto", sans-serif;&lt;/code&gt;:  Defines the base font to be used throughout the website.  If "Roboto" isn't available, then the default sans-serif font will be used.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;--base-padding: 3rem;&lt;/code&gt;: Defines the base spacing.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;--shadow-sm: 0 2px 4px var(--shadow-color);&lt;/code&gt;: Defines a box-shadow style using the var(--shadow-color) CSS variable which was already defined&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;These variables allow you to change the colours, spacing and fonts of your website in one place, without having to update each specific style.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* ===================================================================== Body Styles ===================================================================== */&lt;/span&gt;
&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-font&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;linear-gradient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;45deg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--gradient-start&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--gradient-end&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="nl"&gt;background-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;300%&lt;/span&gt; &lt;span class="m"&gt;300%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;animation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;gradientAnimation&lt;/span&gt; &lt;span class="m"&gt;15s&lt;/span&gt; &lt;span class="n"&gt;ease&lt;/span&gt; &lt;span class="n"&gt;infinite&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;min-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100vh&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--text-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;background-color&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-transition&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;background-attachment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;fixed&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;overflow-x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@keyframes&lt;/span&gt; &lt;span class="n"&gt;gradientAnimation&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="err"&gt;0&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background-position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0%&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="err"&gt;50&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background-position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="err"&gt;100&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background-position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0%&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;body { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; element, which contains the visible content of your page.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;font-family: var(--base-font);&lt;/code&gt;: Sets the font to the base font defined above.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;margin: 0;&lt;/code&gt;:  Removes the default margin (space around the element).&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;background: linear-gradient(45deg, var(--gradient-start), var(--gradient-end));&lt;/code&gt;:  Sets a gradient background.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;background-size: 300% 300%;&lt;/code&gt;:  Makes the gradient bigger than the element, for the animation to work.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;animation: gradientAnimation 15s ease infinite;&lt;/code&gt;:  Starts a CSS animation named &lt;code&gt;gradientAnimation&lt;/code&gt; (defined below) that runs for 15 seconds, infinitely.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;display: flex; flex-direction: column; min-height: 100vh;&lt;/code&gt;: uses a &lt;em&gt;flexbox&lt;/em&gt; layout. &lt;code&gt;flex-direction: column&lt;/code&gt; makes items align vertically and &lt;code&gt;min-height: 100vh&lt;/code&gt; makes the body fill the entire viewport height.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;background-attachment: fixed;&lt;/code&gt; Sets the background to be fixed, and not scroll.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;overflow-x: hidden;&lt;/code&gt; Removes any horizontal scroll.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;@keyframes gradientAnimation { ... }&lt;/code&gt;&lt;/strong&gt;: Defines the gradient animation to change the gradient position.&lt;br&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* ===================================================================== Header Styles ===================================================================== */&lt;/span&gt;
&lt;span class="nt"&gt;header&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1rem&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-padding&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0.15&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="py"&gt;backdrop-filter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;blur&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;5px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex-start&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;border-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0.1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="m"&gt;4px&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0.05&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;background-color&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-transition&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;box-shadow&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-transition&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;header&lt;/span&gt; &lt;span class="nt"&gt;a&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;inherit&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;text-decoration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;opacity&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--fast-transition&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;500&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;inline-block&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding-right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;header&lt;/span&gt; &lt;span class="nt"&gt;a&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;header { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the &lt;code&gt;&amp;lt;header&amp;gt;&lt;/code&gt; element

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;padding: 1rem var(--base-padding);&lt;/code&gt;: Sets vertical padding of &lt;code&gt;1rem&lt;/code&gt;, and the horizontal padding is defined using the &lt;code&gt;base-padding&lt;/code&gt; CSS variable.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;background-color: rgba(255, 255, 255, 0.15);&lt;/code&gt;: Sets a translucent white background.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;backdrop-filter: blur(5px);&lt;/code&gt; This is used to make the background appear blurred.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;display: flex; justify-content: flex-start;&lt;/code&gt; This uses a &lt;em&gt;flexbox&lt;/em&gt; layout, and aligns elements to the start&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;transition: background-color var(--base-transition);&lt;/code&gt;: Sets a transition for the background colour change.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;header a { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the links within the header.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;color: inherit;&lt;/code&gt;: Makes the link color the same as the header's text color.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;text-decoration: none;&lt;/code&gt;: Removes the default underline.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;display: inline-block;&lt;/code&gt; This allows the element to have both block and inline properties&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;header a:hover { ... }&lt;/code&gt;&lt;/strong&gt;:  Styles the links when you hover over them.&lt;br&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* ===================================================================== Container Styles ===================================================================== */&lt;/span&gt;
&lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--card-background&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-padding&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;15px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--shadow-md&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;92%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;800px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;box-shadow&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-transition&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;transform&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-transition&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.container&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-3px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--shadow-lg&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;.container { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the container.  The &lt;code&gt;.&lt;/code&gt; means it targets an element with class &lt;code&gt;container&lt;/code&gt;.

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;background-color: var(--card-background);&lt;/code&gt;: Sets a white background using the CSS variable&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;border-radius: 15px;&lt;/code&gt;: Makes the corners rounded.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;box-shadow: var(--shadow-md);&lt;/code&gt;:  Applies a shadow using the medium shadow variable.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;width: 92%; max-width: 800px;&lt;/code&gt; This makes sure the container fills the screen, but doesn't expand too far, and keeps it centered in the screen.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;margin: auto; margin-top: 3rem; margin-bottom: 3rem;&lt;/code&gt; These centers the container horizontally on the page, and provides margin on the top and bottom.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;.container:hover { ... }&lt;/code&gt;&lt;/strong&gt;:  Adds a slight animation and larger shadow when you hover over it.
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* ===================================================================== Heading Styles ===================================================================== */&lt;/span&gt;
&lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--heading-font&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--primary-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;text-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0.06&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2.6rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-variant-numeric&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;lining-nums&lt;/span&gt; &lt;span class="n"&gt;proportional-nums&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;letter-spacing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;-0.02rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;line-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-transition&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;text-shadow&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-transition&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;h1 { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the main heading (&lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; tag)

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;font-family: var(--heading-font);&lt;/code&gt;: Sets the font to a heading-specific font.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;text-align: center;&lt;/code&gt;: Centers the text&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;color: var(--primary-color);&lt;/code&gt;: Sets the color to the primary colour defined above.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.06);&lt;/code&gt;: Adds a subtle text shadow.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;font-variant-numeric: lining-nums proportional-nums;&lt;/code&gt; Makes numbers look more sophisticated.
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* ===================================================================== Textarea Styles ===================================================================== */&lt;/span&gt;
&lt;span class="nt"&gt;textarea&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;min-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;220px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;16px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--border-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;box-sizing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;border-box&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--code-font&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;white-space&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;pre-wrap&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;overflow-wrap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;break-word&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;resize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;vertical&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;outline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;border-color&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-transition&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;box-shadow&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-transition&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;line-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.6&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--shadow-sm&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;textarea&lt;/span&gt;&lt;span class="nd"&gt;:focus&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;border-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--primary-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--primary-color&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="m"&gt;0.25&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;textarea { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the text box

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;width: 100%;&lt;/code&gt;: Makes it fill the container horizontally.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;min-height: 220px;&lt;/code&gt;: Sets a minimum height.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;border: 2px solid var(--border-color);&lt;/code&gt;: Sets a border.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;font-family: var(--code-font);&lt;/code&gt;: Uses the code font family.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;white-space: pre-wrap; overflow-wrap: break-word;&lt;/code&gt; These properties deal with how text wrapping is handled.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;resize: vertical;&lt;/code&gt;: Allows vertical resizing only.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;outline: none;&lt;/code&gt;:  Removes the default blue outline when focused.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;box-shadow: var(--shadow-sm);&lt;/code&gt;: Adds a shadow&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;textarea:focus { ... }&lt;/code&gt;&lt;/strong&gt;: Changes the style when you click inside the text box, with a focus.
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* ===================================================================== Preformatted Code Styles ===================================================================== */&lt;/span&gt;
&lt;span class="nc"&gt;.code-output-container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;relative&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;pre&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--code-background&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;18px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;overflow-x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;white-space&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;pre-wrap&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;line-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.7&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--code-font&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--shadow-sm&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;background-color&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-transition&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;box-shadow&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-transition&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;pre&lt;/span&gt; &lt;span class="nt"&gt;code&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;block&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;.code-output-container { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the container for the formatted code.&lt;/li&gt;
&lt;li&gt;   &lt;code&gt;position: relative;&lt;/code&gt; Positions the code container relatively so that the buttons are positioned absolutely within.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;pre { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the code display.

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;background-color: var(--code-background);&lt;/code&gt;: Sets the background to the code background color defined in the CSS variables.&lt;/li&gt;
&lt;li&gt;   &lt;code&gt;white-space: pre-wrap;&lt;/code&gt; Allows the code to wrap on new lines&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;pre code { ... }&lt;/code&gt;&lt;/strong&gt;:  Styles the code element within the &lt;code&gt;&amp;lt;pre&amp;gt;&lt;/code&gt; tag.

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;display: block;&lt;/code&gt;: Makes the code take up the full width.
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* ===================================================================== Button Styles ===================================================================== */&lt;/span&gt;
&lt;span class="nc"&gt;.button-container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2.5em&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;16px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;14px&lt;/span&gt; &lt;span class="m"&gt;28px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;pointer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;all&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-transition&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--shadow-md&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.1rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;500&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;relative&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;overflow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;transparent&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="nf"&gt;#beautify-btn&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;linear-gradient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;135deg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--primary-color&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--secondary-color&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="nf"&gt;#minify-btn&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#ffffff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--text-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--border-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="nd"&gt;::before&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0.15&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;scaleX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;transform-origin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;left&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;transform&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt; &lt;span class="n"&gt;ease&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="nd"&gt;:hover::before&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;scaleX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="nf"&gt;#minify-btn&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;#f5f7fa&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-3px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--shadow-lg&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="nd"&gt;:focus&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;outline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;3px&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--primary-color&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="m"&gt;0.3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;.button-container { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the container for the buttons.

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;display: flex; justify-content: center;&lt;/code&gt;: Aligns the buttons horizontally at the center of the container.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;button { ... }&lt;/code&gt;&lt;/strong&gt;: Styles all buttons

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;background: transparent;&lt;/code&gt; Makes the initial background transparent&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;position: relative; overflow: hidden;&lt;/code&gt; Makes the buttons relative and hides any overflow of the before pseudo element.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;transition: all var(--base-transition);&lt;/code&gt; A transition for all properties that the button has, to make it smooth.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;button#beautify-btn { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the "Beautify" button specifically using the id selector.

&lt;ul&gt;
&lt;li&gt; &lt;code&gt;background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));&lt;/code&gt; Adds a gradient background&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;   &lt;strong&gt;&lt;code&gt;button#minify-btn { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the "Minify" button using the id selector.&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;button::before { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the hover effect of the buttons.

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;content: "";&lt;/code&gt; Allows the addition of content to the pseudo element.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;transform: scaleX(0); transform-origin: left;&lt;/code&gt; Starts the element at scale 0 from the left.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;transition: transform 0.3s ease;&lt;/code&gt; Adds a transition for smooth appearance.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;button:hover::before { ... }&lt;/code&gt;&lt;/strong&gt;: expands the pseudo element to show the hover effect&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;button:hover { ... }&lt;/code&gt;&lt;/strong&gt;: styles all buttons when they're hovered over.&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;button:focus { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the button when it's focused with your keyboard.
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* ===================================================================== Copy Code Button Styles ===================================================================== */&lt;/span&gt;
&lt;span class="nc"&gt;.copy-code-btn&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8px&lt;/span&gt; &lt;span class="m"&gt;12px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--border-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;6px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;pointer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.85rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--text-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;background-color&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-transition&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;transform&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--fast-transition&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;box-shadow&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-transition&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--shadow-sm&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.copy-code-btn&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-2px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--shadow-md&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.copy-code-btn&lt;/span&gt;&lt;span class="nd"&gt;:focus&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;outline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--primary-color&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="m"&gt;0.3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;.copy-code-btn { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the "Copy Code" button using the class selector.

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;position: absolute; top: 10px; right: 10px;&lt;/code&gt;: Positions the button at the top right corner of its parent.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;.copy-code-btn:hover { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the "Copy Code" button on hover.&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;.copy-code-btn:focus { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the "Copy Code" button when focused.
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* ===================================================================== Download Code Button Styles ===================================================================== */&lt;/span&gt;
&lt;span class="nc"&gt;.download-code-btn&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;45px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8px&lt;/span&gt; &lt;span class="m"&gt;12px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0.8&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--border-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;6px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;pointer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.85rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--text-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;background-color&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-transition&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;transform&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--fast-transition&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;box-shadow&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--base-transition&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--shadow-sm&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.download-code-btn&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-2px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--shadow-md&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.download-code-btn&lt;/span&gt;&lt;span class="nd"&gt;:focus&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;outline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--primary-color&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="m"&gt;0.3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;.download-code-btn { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the "Download Code" button. Works very similarly to the copy button with a different position.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* ===================================================================== Notification Styles ===================================================================== */&lt;/span&gt;
&lt;span class="nf"&gt;#notification-container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;fixed&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-50%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;z-index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;pointer-events&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Allows clicks to pass through */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.notification&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#ffffff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--text-color&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;12px&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--shadow-md&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;opacity&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt; &lt;span class="n"&gt;ease&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;transform&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt; &lt;span class="n"&gt;ease&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;-20px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;pointer-events&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.notification.show&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;transform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;translateY&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.notification.success&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#e8f5e9&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#388e3c&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#c8e6c9&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.notification.error&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#ffebee&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#d32f2f&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#ef9a9a&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;#notification-container { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the container for notifications.

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;position: fixed; top: 20px; left: 50%; transform: translateX(-50%);&lt;/code&gt;: Keeps the notification at the top of the page, centered horizontally.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;.notification { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the basic notification message.

&lt;ul&gt;
&lt;li&gt; &lt;code&gt;pointer-events: auto;&lt;/code&gt;: This is used to allow hover effects on notifications, which are by default disabled because of their parent container.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;.notification.show { ... }&lt;/code&gt;&lt;/strong&gt;: Styles the notification when it is to be shown to the user.&lt;/li&gt;

&lt;li&gt;  &lt;strong&gt;&lt;code&gt;.notification.success { ... }&lt;/code&gt;&lt;/strong&gt;: Styles successful notifications in green.&lt;/li&gt;

&lt;li&gt; &lt;strong&gt;&lt;code&gt;.notification.error { ... }&lt;/code&gt;&lt;/strong&gt;: Styles error notifications in red.
&lt;/li&gt;

&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* ===================================================================== Responsive Adjustments ===================================================================== */&lt;/span&gt;
&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;768px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;header&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1rem&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--small-padding&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--small-padding&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;95%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2.2rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.8em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;textarea&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.95rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;min-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;200px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;pre&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.95rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;12px&lt;/span&gt; &lt;span class="m"&gt;24px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.copy-code-btn&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;6px&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.8rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.download-code-btn&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;6px&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.8rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;40px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nf"&gt;#notification-container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;576px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nt"&gt;header&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1rem&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--tiny-padding&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--tiny-padding&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;margin-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.5rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.5rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;h1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.5em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;textarea&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.9rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;min-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;180px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;pre&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.85rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.95rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;8px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.copy-code-btn&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt; &lt;span class="m"&gt;8px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.75rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;6px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;6px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.download-code-btn&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt; &lt;span class="m"&gt;8px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.75rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;38px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;6px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;@media (max-width: 768px) { ... }&lt;/code&gt;&lt;/strong&gt;: This is a &lt;em&gt;media query&lt;/em&gt;. The styles within are only applied when the browser window is 768 pixels wide or less (for smaller screens like tablets). This section adjusts things like font size and padding to make the layout work on smaller screens.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;@media (max-width: 576px) { ... }&lt;/code&gt;&lt;/strong&gt;: Styles for even smaller screens (like smartphones).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Stylistic Choices and Why They Are Made
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;CSS Variables:&lt;/strong&gt; Using variables makes the code easier to maintain and update. If you want to change the primary color, you can do it in one place instead of hunting down all its instances.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Box Shadows &amp;amp; Transitions:&lt;/strong&gt;  Adds a modern touch and makes the interface feel more interactive and polished.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Clean Typography:&lt;/strong&gt; Uses legible fonts that make the page readable and visually appealing.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Responsive Design:&lt;/strong&gt; The &lt;code&gt;@media&lt;/code&gt; queries make sure the tool looks good on different devices, which is essential for good user experience, and ofcourse good ol' SEO.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Clear Visual Hierarchy:&lt;/strong&gt; The heading is distinct, the textarea is clearly labeled, and the buttons are easy to find and click.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Emphasis on Code Blocks:&lt;/strong&gt; The pre-formatted code block is given a different background and font to distinguish it from the other elements.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In summary, this CSS file styles your Code Beautifier tool, giving it a modern, clean, and user-friendly appearance. It uses variables, transitions, and responsive design to make the tool effective and easy to use.&lt;/p&gt;

&lt;p&gt;This is a lot to take in at once, but with practice and time, these concepts will become second nature to you!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Creating a live HTML, CSS and JS displayer</title>
      <dc:creator>Kavya Sahai</dc:creator>
      <pubDate>Wed, 15 Jan 2025 21:15:04 +0000</pubDate>
      <link>https://forem.com/kavya-sahai-god/creating-a-live-html-css-and-js-displayer-2e2b</link>
      <guid>https://forem.com/kavya-sahai-god/creating-a-live-html-css-and-js-displayer-2e2b</guid>
      <description>&lt;p&gt;How does one one learn web development you may ask? Simple answer, by building projects. Even if you don't know anything in HTML, CSS and JS; follow along, I bet you you'll learn a lot today, and potentially build amazing websites.&lt;/p&gt;

&lt;p&gt;Today, we are building a live html, css and javscript displayer, similar to CodePen.io but better. You may ask how? I don't know either, we'll find out something definitely. Get ready volks, as it is going to be a heck of a ride.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is HTML?
&lt;/h2&gt;

&lt;p&gt;First, HTML stands for &lt;strong&gt;HyperText Markup Language&lt;/strong&gt;. Think of it as the skeleton of a website. It's what defines the structure and content of the page (text, images, buttons, etc.). It's written using special "tags," which are like instructions for the browser (the software you use to view websites). &lt;/p&gt;

&lt;h2&gt;
  
  
  HTML Marking Process with explanation
&lt;/h2&gt;

&lt;p&gt;If you are not a complete newbie, you can skip this section directly to the next section. But if you have never placed hand on an HTML document, or even seen it, this is for you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/code&gt; First we start with this declaration, this is like saying, "Hey browser, this is an HTML5 document!" It tells the browser what kind of document to expect so it can render it correctly.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;html lang="en"&amp;gt;&lt;/code&gt; This is the main container for everything on the page. It's like the foundation of the house. &lt;code&gt;lang="en"&lt;/code&gt; tells the browser that the language of the content is English(United States).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; This part of the code contains information about the webpage, not what you see on the page itself. It's like the blueprints' notes and specifications. Mostly, web devs (Abbr.: Web Developers) add it for SEO purposes, and it is generally advised to add one.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;meta charset="UTF-8"&amp;gt;&lt;/code&gt;This line specifies what character set the page uses. UTF-8 is a standard one that allows the page to display most characters and symbols correctly. It's like ensuring the letters and numbers in your blueprints can be understood by everyone.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;&lt;/code&gt; This is important for websites to work well on different devices (phones, tablets, computers). It tells the browser how to scale and fit the page to the screen.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;title&amp;gt;Sleek HTML/CSS/JS Displayer&amp;lt;/title&amp;gt;&lt;/code&gt; This is what appears in the browser tab or window title bar. It's like adding a nameplate in front of your house.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;link rel="stylesheet" href="style.css"&amp;gt;&lt;/code&gt; This line is saying "Hey! Go find a file called style.css and use it to make the page look pretty." style.css is a separate file that contains &lt;strong&gt;CSS&lt;/strong&gt; (Cascading Style Sheets), which is responsible for the visual appearance of the page (colors, fonts, spacing, layout). It's like painting the walls and furnishing the house. For those, experienced web devs, who are seeing this, this seems out of a VSC boiler plate, because it is. For new developers, in VSC, one can use &lt;code&gt;!&lt;/code&gt; to generate a boilerplate fast. One can also set custom boiler plates, I do that a lot.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/.../all.min.css"&amp;gt;&lt;/code&gt; This line also links to a CSS file, but this one is hosted on a website (cdnjs.cloudflare.com). It contains definitions for icons used in the page, from a library called Font Awesome. It's like getting a pre-built PC.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;/head&amp;gt;&lt;/code&gt; This closes the head tag.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, we move to the body, the main part of your html, that the users will see. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; This is where the content of your webpage goes—what users see in the browser window. It's like the rooms of the house, which the guests see.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;div class="app-container"&amp;gt;&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; is a generic container that groups other elements. It's like dividing your house into sections.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;class="app-container"&lt;/code&gt; is a label for this container so you can style it with CSS or work with it using JavaScript.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;&amp;lt;header class="app-header"&amp;gt;&lt;/code&gt;  is where the header content goes (title, logo, buttons, etc.). This is like the front door and entryway of your house.&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;&amp;lt;div class="logo"&amp;gt;HTML, CSS and JS Editor&amp;lt;/div&amp;gt;&lt;/code&gt; This is another &lt;code&gt;div&lt;/code&gt; container, but this one contains the name of the editor.&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;&amp;lt;div class="controls"&amp;gt; ... &amp;lt;/div&amp;gt;&lt;/code&gt; This div contains elements that control the app, including a link and a couple of buttons.&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;&amp;lt;a href="/blog/" style="...; transition: opacity 0.3s; ..."&amp;gt;Learn HTML, CSS and JS for free&amp;lt;/a&amp;gt;&lt;/code&gt; 

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; is an anchor tag that creates a link. When clicked, it takes you to the address written in href (in this case to /blog/).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;style&lt;/code&gt; is an attribute that lets you apply custom styles, instead of always changing the html code.&lt;/li&gt;
&lt;li&gt;The other styles specified here affect how the link looks and how it changes when it's hovered over. It will be discussed later, in CSS section :D&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;&amp;lt;button id="theme-toggle"&amp;gt;&amp;lt;i class="fas fa-moon"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;i class="fas fa-sun"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/button&amp;gt;&lt;/code&gt; This creates a button. &lt;code&gt;id="theme-toggle"&lt;/code&gt; is a unique identifier for this button so you can style it with CSS or work with it using JavaScript. &lt;code&gt;&amp;lt;i&amp;gt;&lt;/code&gt; tags contain icons from the font awesome library. It renders the moon icon, used to indicate Dark Mode.&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;&amp;lt;button id="full-screen-toggle"&amp;gt;&amp;lt;i class="fas fa-expand"&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/button&amp;gt;&lt;/code&gt; Another button with an icon inside it, that is used to toggle fullscreen.&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Now, we can close the header tag using &lt;code&gt;&amp;lt;/header&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;div class="code-editor-container"&amp;gt; ... &amp;lt;/div&amp;gt;&lt;/code&gt; This &lt;code&gt;div&lt;/code&gt; container holds the parts that make up the code editor.&lt;/li&gt;
&lt;li&gt;Now, within the &lt;code&gt;.code-editor-container&lt;/code&gt; (Abbr.: div with class = code-editor-container) we can add &lt;code&gt;&amp;lt;div class="code-pane"&amp;gt; ... &amp;lt;/div&amp;gt;&lt;/code&gt; This contains the "code" part of the application.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;div class="editor-header"&amp;gt; ... &amp;lt;/div&amp;gt;&lt;/code&gt; This holds the elements on top of the code area (HTML, CSS, JS)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;span class="tab active" data-code="html"&amp;gt;HTML&amp;lt;/span&amp;gt;&lt;/code&gt; &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; is a simple container for text. &lt;code&gt;class="tab active"&lt;/code&gt; gives it styling and indicates this tab is active. &lt;code&gt;data-code="html"&lt;/code&gt; is data associated with the &lt;span&gt; element.&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;span class="tab" data-code="css"&amp;gt;CSS&amp;lt;/span&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;span class="tab" data-code="js"&amp;gt;JS&amp;lt;/span&amp;gt;&lt;/code&gt; These are span tags for the CSS and Javascript tabs.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;div class="code-area"&amp;gt; ... &amp;lt;/div&amp;gt;&lt;/code&gt; This &lt;code&gt;div&lt;/code&gt; container holds the area for the different editors.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;div class="line-numbers"&amp;gt;1&amp;lt;/div&amp;gt;&lt;/code&gt; This div contains the line numbers. In this case only the "1" is there.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;textarea id="html-code" class="code-input active" placeholder="HTML Code"&amp;gt;&amp;lt;/textarea&amp;gt;&lt;/code&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;textarea&amp;gt;&lt;/code&gt; is a multiline text input box where users can write code.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;id="html-code"&lt;/code&gt; is an identifier to work with it using JavaScript or style it with CSS.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;class="code-input active"&lt;/code&gt; allows you to style the &lt;code&gt;textarea&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;placeholder="HTML Code"&lt;/code&gt; adds a message that is displayed in the &lt;code&gt;textarea&lt;/code&gt; until the user types in it.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;&amp;lt;textarea id="css-code" class="code-input" placeholder="CSS Code"&amp;gt;&amp;lt;/textarea&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;textarea id="js-code" class="code-input" placeholder="JavaScript Code"&amp;gt;&amp;lt;/textarea&amp;gt;&lt;/code&gt; These are similar to the HTML &lt;code&gt;textarea&lt;/code&gt;, but used for CSS and JavaScript code respectively.&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;Now, we can close both the div tags using &lt;code&gt;&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;div class="preview-pane"&amp;gt; ... &amp;lt;/div&amp;gt;&lt;/code&gt; This is where the website preview will be.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;iframe id="preview"&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/code&gt;  is used to embed another webpage (in this case, the code written in the textareas) into the current page.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now close .preview-pane using &lt;code&gt;&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;I had also added a footer in the final version, but, it is not required.&lt;/p&gt;

&lt;p&gt;Now, we can close the body and html tags also. &lt;/p&gt;

&lt;h3&gt;
  
  
  Explained till now
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;HTML uses tags (e.g., &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt;) to structure content, and their roles.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; section contains metadata (information about the page).&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; section contains the visible content.&lt;/li&gt;
&lt;li&gt;External CSS files (linked with &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt;) handle the visual appearance.&lt;/li&gt;
&lt;li&gt;External JavaScript files (linked with &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt;) handle interactivity.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Actual code:
&lt;/h2&gt;

&lt;p&gt;I presume, for intermediates, who know these basic principles, they want the code directly and can learn from it only.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&lt;/span&gt; &lt;span class="na"&gt;lang=&lt;/span&gt;&lt;span class="s"&gt;"en"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"viewport"&lt;/span&gt; &lt;span class="na"&gt;content=&lt;/span&gt;&lt;span class="s"&gt;"width=device-width, initial-scale=1.0"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Sleek HTML/CSS/JS Displayer&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"style.css"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"&lt;/span&gt; &lt;span class="na"&gt;integrity=&lt;/span&gt;&lt;span class="s"&gt;"sha512-9usAa10IRO0HhonpyAIVpjrylPvoDwiPUiKdWk5t3PyolY1cOd4DSE0Ga+ri4AuTroPR5aQvXU9xC6qOPnzFeg=="&lt;/span&gt; &lt;span class="na"&gt;crossorigin=&lt;/span&gt;&lt;span class="s"&gt;"anonymous"&lt;/span&gt; &lt;span class="na"&gt;referrerpolicy=&lt;/span&gt;&lt;span class="s"&gt;"no-referrer"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"app-container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;header&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"app-header"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"logo"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;HTML, CSS and JS Editor&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"controls"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"/blog/"&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"text-decoration: none; color: inherit; transition: opacity 0.3s; opacity: 0.8; padding-right: 20px;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Learn HTML, CSS and JS for free&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"theme-toggle"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;i&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"fas fa-moon"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;i&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"fas fa-sun"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"full-screen-toggle"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;i&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"fas fa-expand"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/i&amp;gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
          &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;

      &lt;span class="nt"&gt;&amp;lt;/header&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"code-editor-container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"code-pane"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
              &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"editor-header"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
                  &lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"tab active"&lt;/span&gt; &lt;span class="na"&gt;data-code=&lt;/span&gt;&lt;span class="s"&gt;"html"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;HTML&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
                  &lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"tab"&lt;/span&gt; &lt;span class="na"&gt;data-code=&lt;/span&gt;&lt;span class="s"&gt;"css"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;CSS&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
                  &lt;span class="nt"&gt;&amp;lt;span&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"tab"&lt;/span&gt; &lt;span class="na"&gt;data-code=&lt;/span&gt;&lt;span class="s"&gt;"js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;JS&lt;span class="nt"&gt;&amp;lt;/span&amp;gt;&lt;/span&gt;
              &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"code-area"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
                   &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"line-numbers"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;1&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
                   &lt;span class="nt"&gt;&amp;lt;textarea&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"html-code"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"code-input active"&lt;/span&gt; &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"HTML Code"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/textarea&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;textarea&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"css-code"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"code-input"&lt;/span&gt; &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"CSS Code"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/textarea&amp;gt;&lt;/span&gt;
                    &lt;span class="nt"&gt;&amp;lt;textarea&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"js-code"&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"code-input"&lt;/span&gt; &lt;span class="na"&gt;placeholder=&lt;/span&gt;&lt;span class="s"&gt;"JavaScript Code"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/textarea&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"preview-pane"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
                &lt;span class="nt"&gt;&amp;lt;iframe&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"preview"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;footer&amp;gt;&lt;/span&gt;
            &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Made with ❤️ by Kavya Sahai&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;/footer&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"script.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What is CSS?
&lt;/h2&gt;

&lt;p&gt;CSS (Cascading Style Sheets) is used to style and layout web pages. It controls things like colors, fonts, spacing, and the overall visual appearance of your website. Think of it as the decorator of your house, that dictates how the walls look, where the furniture is placed, and generally it makes it beautiful.&lt;/p&gt;

&lt;h3&gt;
  
  
  Selectors
&lt;/h3&gt;

&lt;p&gt;CSS uses selectors to target HTML elements you want to style. For example, &lt;code&gt;body&lt;/code&gt; selects the entire body of your HTML document, and &lt;code&gt;.app-header&lt;/code&gt; selects all elements with the class "app-header". We've discussed the classes in the past HTML section. &lt;/p&gt;

&lt;h3&gt;
  
  
  Properties &amp;amp; Values
&lt;/h3&gt;

&lt;p&gt;After the selector, in the curly braces &lt;code&gt;{ }&lt;/code&gt;, you have properties and values. For example, &lt;code&gt;color: #333;&lt;/code&gt; sets the text color to a dark grey.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code Explanation
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Reset &amp;amp; Base Styles */&lt;/span&gt;
&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;box-sizing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;border-box&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;*&lt;/code&gt;: This is a universal selector, which applies to all the elements on your page.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;margin: 0;&lt;/code&gt;: Sets the outer space around elements to zero, meaning no space is provided to the element.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;padding: 0;&lt;/code&gt;: Sets the inner space (between an element's border and its content) to zero.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;box-sizing: border-box;&lt;/code&gt; makes the size of the box to account for border and padding&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is like a "reset," to remove default spacing to ensure consistency.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;'Arial'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#f4f4f4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#333&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;background-color&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/*Theme Transition */&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;font-family: 'Arial', sans-serif;&lt;/code&gt;: Sets the default font to Arial, or any generic sans-serif font if Arial is not available.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;background-color: #f4f4f4;&lt;/code&gt;: Sets a very light gray background.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;color: #333;&lt;/code&gt;: Sets the default text color to dark gray.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;transition: background-color 0.3s, color 0.3s;&lt;/code&gt;: creates smooth transitions of 0.3 seconds, when the color/background color changes.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="nc"&gt;.dark-theme&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#1a1a1a&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;body.dark-theme&lt;/code&gt;: This selects the &lt;code&gt;body&lt;/code&gt; element, when the class &lt;code&gt;.dark-theme&lt;/code&gt; is added.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;background-color: #1a1a1a;&lt;/code&gt;: sets a dark background.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;color:#fff;&lt;/code&gt;: sets a white text.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This styles the webpage for dark mode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nc"&gt;.app-container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;min-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100vh&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Ensure full height */&lt;/span&gt;
      &lt;span class="nl"&gt;overflow-x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;display: flex;&lt;/code&gt;: Turns the container into a flexbox, which allows you to control the layout of its children.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;flex-direction: column;&lt;/code&gt;: Arranges the content inside the &lt;code&gt;app-container&lt;/code&gt; in a vertical column.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;min-height: 100vh;&lt;/code&gt;: Sets the minimum height of the container to the entire viewport height.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;overflow-x:hidden;&lt;/code&gt; : hides the elements that overflow horizontally.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes the app fill the full page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* Header Style */&lt;/span&gt;
  &lt;span class="nc"&gt;.app-header&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;space-between&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#f0f0f0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;border-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#ddd&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;background-color&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;justify-content: space-between;&lt;/code&gt;: Pushes the elements within the header (logo and controls) to the opposite ends, spreading them out.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;align-items: center;&lt;/code&gt;: Vertically aligns the elements in the center of the header.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;padding: 20px;&lt;/code&gt;: adds 20px inner spacing to the element.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;border-bottom: 1px solid #ddd;&lt;/code&gt;: Adds a 1px thin gray border at the bottom.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;transition: background-color 0.3s;&lt;/code&gt;: adds a smooth background color change effect for 0.3 seconds
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nc"&gt;.app-header.dark-theme&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;#2a2a2a&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This sets a darker background for the header in dark mode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nc"&gt;.logo&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.5em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bold&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;text-decoration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/*Remove Link Decoration*/&lt;/span&gt;
      &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#222&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Text Colour */&lt;/span&gt;
      &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.app-header.dark-theme&lt;/span&gt; &lt;span class="nc"&gt;.logo&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;font-size: 1.5em;&lt;/code&gt;: Em Units makes the text's size 1.5 times the parent text size.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;font-weight: bold;&lt;/code&gt;: Makes the text bold.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;text-decoration: none;&lt;/code&gt;: Removes the default underline from links.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;color: #222;&lt;/code&gt;: sets the text color to a dark color.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The second part styles the logo's color for the dark mode header.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nc"&gt;.controls&lt;/span&gt; &lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nb"&gt;pointer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#555&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.controls&lt;/span&gt; &lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#222&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.app-header.dark-theme&lt;/span&gt; &lt;span class="nc"&gt;.controls&lt;/span&gt; &lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;background: none;&lt;/code&gt;: Makes the button's background transparent.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;border: none;&lt;/code&gt;: Removes the default border around the button.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;cursor: pointer&lt;/code&gt;: changes cursor to pointer when hovered on the button.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;color: #555;&lt;/code&gt;: Sets an initial text color for the buttons.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;transition: color 0.3s;&lt;/code&gt;: makes a smooth color change of the text on hover.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;color: #222;&lt;/code&gt; when the button is hovered, change color to another dark tone.&lt;/li&gt;
&lt;li&gt;   The last part defines the text color for dark mode buttons.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="c"&gt;/*Hide default sun icon and display default moon icon*/&lt;/span&gt;
  &lt;span class="nc"&gt;.controls&lt;/span&gt; &lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="nt"&gt;i&lt;/span&gt;&lt;span class="nc"&gt;.fa-sun&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.app-header.dark-theme&lt;/span&gt; &lt;span class="nc"&gt;.controls&lt;/span&gt; &lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="nt"&gt;i&lt;/span&gt;&lt;span class="nc"&gt;.fa-moon&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.app-header.dark-theme&lt;/span&gt; &lt;span class="nc"&gt;.controls&lt;/span&gt; &lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="nt"&gt;i&lt;/span&gt;&lt;span class="nc"&gt;.fa-sun&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;inline-block&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;display:none;&lt;/code&gt;: makes the element hidden.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;display:inline-block;&lt;/code&gt;: makes the element visible.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This hides the sun icon and shows the moon icon, initially. When in Dark Mode, it hides moon, and shows the sun.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="c"&gt;/* Code Editor Area */&lt;/span&gt;
  &lt;span class="nc"&gt;.code-editor-container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Take remaining space */&lt;/span&gt;
      &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;calc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;100vh&lt;/span&gt; &lt;span class="n"&gt;-&lt;/span&gt; &lt;span class="m"&gt;130px&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c"&gt;/* account for header and footer height */&lt;/span&gt;
      &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#ddd&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;overflow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Avoid overflow */&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt; &lt;code&gt;flex: 1;&lt;/code&gt; makes the element grow, and occupy remaining space.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;height:calc(100vh - 130px);&lt;/code&gt; Sets the height of the element to 100% of the screen height minus 130 pixels.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;border-radius: 5px;&lt;/code&gt;: Gives the container rounded corners.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;overflow: hidden;&lt;/code&gt; : prevents elements from overflowing on the container.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This creates a layout for code editor with some spacing around it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="c"&gt;/* Editor Header*/&lt;/span&gt;
  &lt;span class="nc"&gt;.editor-header&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#f8f8f8&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;border-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#ddd&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This adds a thin bottom border and very light background color to the editor header.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nc"&gt;.editor-header&lt;/span&gt; &lt;span class="nc"&gt;.tab&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt; &lt;span class="m"&gt;15px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;pointer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#555&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;background-color&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;border-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="nb"&gt;transparent&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This styles the editor tabs, which allow us to switch between HTML, CSS, and JS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nc"&gt;.editor-header&lt;/span&gt; &lt;span class="nc"&gt;.tab&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
     &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;#eee&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives the tab a light gray background when hovered on.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nc"&gt;.editor-header&lt;/span&gt; &lt;span class="nc"&gt;.tab.active&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;border-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#4a90e2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Highlight active tab */&lt;/span&gt;
      &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#222&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bold&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.editor-header&lt;/span&gt; &lt;span class="nc"&gt;.tab.active.dark-theme&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#2a2a2a&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This styles the currently active tab, with a background and a bottom border highlight. The second block of code is for dark mode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nc"&gt;.code-pane&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;.preview-pane&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;box-sizing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;border-box&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;overflow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* prevent code overflow */&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This sets up the basic shared styles for code pane and preview pane.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nc"&gt;.code-area&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;relative&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This sets up the code area, to have a flexible height and to hold absolute positioned elements.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nc"&gt;.code-area&lt;/span&gt; &lt;span class="nc"&gt;.line-numbers&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;right&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;border-right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#ddd&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#f8f8f8&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#999&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;white-space&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;pre-line&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;line-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;overflow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="py"&gt;user-select&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;background-color&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.code-area&lt;/span&gt; &lt;span class="nc"&gt;.line-numbers.dark-theme&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#2a2a2a&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;border-right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#4a4a4a&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;#666&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;white-space: pre-line;&lt;/code&gt;: Makes line numbers to break correctly&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;user-select: none;&lt;/code&gt;: Makes the line numbers non-selectable&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This styles the line numbers with background, border and text properties, and the second block of code is for dark mode.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nc"&gt;.code-input&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;monospace&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;outline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;resize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/*Remove Resize Handle*/&lt;/span&gt;
      &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;line-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Hide Default*/&lt;/span&gt;
      &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;background-color&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.code-input.active&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nb"&gt;block&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.code-input.dark-theme&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;#2a2a2a&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#eee&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;font-family: monospace;&lt;/code&gt;: Sets the code font to a monospaced font, where all letters occupy same space.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;outline: none;&lt;/code&gt;: Removes the default outline that appears when an element is focused.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;resize: none;&lt;/code&gt;: removes the resize handler.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;display: none;&lt;/code&gt;: Hide the element by default.&lt;/li&gt;
&lt;li&gt;   &lt;code&gt;display:block;&lt;/code&gt;: show the element, when the class active is added.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This styles the text area for the code input and adds a dark mode theme to it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nc"&gt;.preview-pane&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;border-left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#ddd&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Center iframe in container*/&lt;/span&gt;
      &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;border-left&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;background-color&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.preview-pane.dark-theme&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#1a1a1a&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;border-left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#3a3a3a&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This styles the preview pane with a white background, left border and the dark mode styling.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="nf"&gt;#preview&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;opacity&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Smooth animation */&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This styles the &lt;code&gt;iframe&lt;/code&gt; which holds the preview.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; &lt;code&gt;transition: opacity 0.3s;&lt;/code&gt;: Smoothly transitions the opacity
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="c"&gt;/* Footer Styles */&lt;/span&gt;
  &lt;span class="nt"&gt;footer&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;border-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#ddd&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#f0f0f0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;background-color&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;footer&lt;/span&gt;&lt;span class="nc"&gt;.dark-theme&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;#2a2a2a&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;border-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="m"&gt;#3a3a3a&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Styles for the footer at the bottom with a thin line and some padding.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="c"&gt;/* Full Screen Styles */&lt;/span&gt;
  &lt;span class="nc"&gt;.full-screen&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;fixed&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#fff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;z-index&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Ensure it overlays everything */&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.full-screen&lt;/span&gt; &lt;span class="nc"&gt;.code-editor-container&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.full-screen&lt;/span&gt; &lt;span class="nc"&gt;.preview-pane&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.full-screen&lt;/span&gt; &lt;span class="nc"&gt;.controls&lt;/span&gt; &lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="nt"&gt;i&lt;/span&gt;&lt;span class="nc"&gt;.fa-expand&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nc"&gt;.full-screen&lt;/span&gt; &lt;span class="nc"&gt;.controls&lt;/span&gt; &lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="nt"&gt;i&lt;/span&gt;&lt;span class="nc"&gt;.fa-compress&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;inline-block&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;position: fixed;&lt;/code&gt;: makes an element stick to a position in viewport and not move with the scroll.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;z-index:1000;&lt;/code&gt; makes the element to go above other elements, and appear on top.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is responsible for making the code editor to take full screen. It hides the expand icon and shows the compress icon.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;  &lt;span class="c"&gt;/*Hide default compress icon, show only on fullscreen*/&lt;/span&gt;
  &lt;span class="nc"&gt;.controls&lt;/span&gt; &lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="nt"&gt;i&lt;/span&gt;&lt;span class="nc"&gt;.fa-compress&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This hides the compress icon by default.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Concepts&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Flexbox:&lt;/strong&gt; A powerful layout tool to arrange elements in a container.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Transitions:&lt;/strong&gt; Used to create smooth animations when properties change.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Dark Mode:&lt;/strong&gt;  Styles for when the page is in dark mode (darker backgrounds, lighter text, etc.).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Specific Selectors&lt;/strong&gt; &lt;code&gt;.class&lt;/code&gt; selects all elements with the class specified.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And now for the final boss, the JS💀&lt;/p&gt;

&lt;h2&gt;
  
  
  What is JavaScript?
&lt;/h2&gt;

&lt;p&gt;JavaScript is a programming language that adds interactivity to websites. It allows you to make your webpage dynamic, such as responding to user actions, updating content without reloading the page, and more. In the analogy of house, Javascript is the electrical wiring that controls the lights, the doors, and other interactive elements.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code Explanation
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Selecting Elements
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;htmlCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;html-code&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cssCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;css-code&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;jsCode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;js-code&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;preview&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;preview&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;codePanes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.code-input&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;tabBtns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.tab&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;lineNumbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.line-numbers&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;themeToggle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;theme-toggle&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;appContainer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.app-container&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;body&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fullScreenToggle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;full-screen-toggle&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;container&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.app-container&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;const&lt;/code&gt;: This declares a constant variable, that cannot be reassigned.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;document.getElementById('id')&lt;/code&gt;: This selects a single HTML element, from the document, using its unique ID. It's like picking a specific object from your house, based on its special label.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;document.querySelectorAll('.class')&lt;/code&gt;: selects all the elements that have the given class.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;document.querySelector('.class')&lt;/code&gt; : selects the first element from the document, with a given class.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These lines are selecting various HTML elements from your page using their IDs or classes, so we can later work with them using JavaScript. For instance, it selects all the text boxes for HTML, CSS and JS using respective id, and saves it to a variable named &lt;code&gt;htmlCode&lt;/code&gt;, &lt;code&gt;cssCode&lt;/code&gt;, &lt;code&gt;jsCode&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Setting up a Full Screen toggle
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;isFullScreen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This declares a new variable &lt;code&gt;isFullScreen&lt;/code&gt; which checks if the editor is in full screen.&lt;/p&gt;

&lt;h3&gt;
  
  
  3.  &lt;code&gt;updatePreview&lt;/code&gt; Function
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;updatePreview&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;html&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;htmlCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;css&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`&amp;lt;style&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;cssCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/style&amp;gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;js&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`&amp;lt;script&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;jsCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/script&amp;gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;combined&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`&amp;lt;!DOCTYPE html&amp;gt;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;css&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;html&lt;/span&gt;&lt;span class="p"&gt;}${&lt;/span&gt;&lt;span class="nx"&gt;js&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="nx"&gt;preview&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;srcdoc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;combined&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;const updatePreview = () =&amp;gt; { ... }&lt;/code&gt;: This defines a function named &lt;code&gt;updatePreview&lt;/code&gt;. A function is like a mini-program that performs a specific task.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;htmlCode.value&lt;/code&gt;:  This gets the content that the user has typed into the HTML text box.&lt;/li&gt;
&lt;li&gt;  Similar to above, &lt;code&gt;cssCode.value&lt;/code&gt; and &lt;code&gt;jsCode.value&lt;/code&gt; gets the values of their respective text areas.&lt;/li&gt;
&lt;li&gt;  Then the function creates strings (pieces of text) from the code user input, which wrap around in html style tags and script tags.&lt;/li&gt;
&lt;li&gt;  Then the function combines these strings in a complete HTML document string.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;preview.srcdoc = combined;&lt;/code&gt;: This puts the combined HTML document into the &lt;code&gt;iframe&lt;/code&gt; (preview window), which renders the webpage.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This function takes the code in the editor and shows the result in the preview. It essentially creates the user interface.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Debouncing Function
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;debounce&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;func&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;timeout&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(...&lt;/span&gt;&lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;clearTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;timeout&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;timeout&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nx"&gt;func&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;args&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="nx"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;const debounce = (func, delay) =&amp;gt; { ... }&lt;/code&gt;: This defines a function named &lt;code&gt;debounce&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  This function takes another function (&lt;code&gt;func&lt;/code&gt;) and a delay (&lt;code&gt;delay&lt;/code&gt;) as parameters.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;clearTimeout(timeout);&lt;/code&gt;: If the function is called again before delay, it cancels any ongoing timer.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;setTimeout(() =&amp;gt; { ... }, delay);&lt;/code&gt;: A timer is started to call the function, once the delay is over.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This &lt;code&gt;debounce&lt;/code&gt; function prevents the preview from updating too frequently, making it more efficient. It's like waiting a few seconds before answering the phone, to ensure you get all the message. This is really useful when you type and the code rerenders for each keystroke.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Applying Debounce
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;debouncedUpdate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;debounce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;updatePreview&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a new function called &lt;code&gt;debouncedUpdate&lt;/code&gt; by using the previously defined &lt;code&gt;debounce&lt;/code&gt; function, which makes &lt;code&gt;updatePreview&lt;/code&gt; update at most once every 200 milliseconds.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. &lt;code&gt;updateLineNumbers&lt;/code&gt; Function
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;updateLineNumbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;lines&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;htmlCode&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nx"&gt;lineNumbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;length&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nx"&gt;lines&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;This selects the HTML element with the class "line-numbers", that shows line numbers in the text area.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;htmlCode.value.split('\n')&lt;/code&gt;: It splits the HTML code string into an array of strings, on each new line ("\n").&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;length&lt;/code&gt; on the array gives the number of lines.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Array.from({length:lines}, (_,i)=&amp;gt; i+1).join("\n")&lt;/code&gt; This code generates an array of numbers, starting from 1, to the number of lines. Then joins them in a single string, separated by newlines.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;lineNumbers.innerText = ...&lt;/code&gt;: It puts this new string into the inner text of lineNumbers element.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This function updates the line numbers in the code editor. It's like adding a counter on the side of your house.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Event Listeners
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;codePanes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;codePane&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;codePane&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;input&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;updateLineNumbers&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nf"&gt;debouncedUpdate&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;codePanes.forEach(codePane =&amp;gt; { ... });&lt;/code&gt;: This runs the following block of code for every element in the list called &lt;code&gt;codePanes&lt;/code&gt; (all the code input text boxes).&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;codePane.addEventListener('input', () =&amp;gt; { ... });&lt;/code&gt;: Whenever the user types anything into any of the code input text boxes, the arrow function, in &lt;code&gt;{}&lt;/code&gt; is executed.&lt;/li&gt;
&lt;li&gt;  The function calls &lt;code&gt;updateLineNumbers()&lt;/code&gt; and &lt;code&gt;debouncedUpdate()&lt;/code&gt;, so when users type, the preview and line numbers are updated.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This sets up the editor to dynamically update whenever text input is detected. It's like the house reacting to your touch.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;tabBtns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;tab&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;tab&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;codeType&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getAttribute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;data-code&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;tabBtns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;btn&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;btn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;active&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;active&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="nx"&gt;codePanes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pane&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;pane&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;active&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
          &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pane&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;codeType&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;-code`&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
              &lt;span class="nx"&gt;pane&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;active&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
          &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;});&lt;/span&gt;
        &lt;span class="nf"&gt;updateLineNumbers&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;  This selects each of the tab elements (HTML, CSS, JS), using &lt;code&gt;tabBtns.forEach(tab =&amp;gt; { ... })&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;addEventListener('click', function(){ ... });&lt;/code&gt; If a user clicks on a tab, the following code will be executed.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;const codeType = this.getAttribute('data-code');&lt;/code&gt;: Gets the attribute value for data-code for clicked tab. This gives 'html', 'css', 'js'.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tabBtns.forEach(btn =&amp;gt; btn.classList.remove('active'));&lt;/code&gt; removes the active class from all of the tabs, and shows unselected.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;this.classList.add('active');&lt;/code&gt; adds the class active to the clicked tab.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;codePanes.forEach(pane =&amp;gt; { ... });&lt;/code&gt;: It iterates over each of the text areas.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;pane.classList.remove('active');&lt;/code&gt; removes the active class from the textarea&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;if (pane.id ===&lt;/code&gt;${codeType}-code&lt;code&gt;){ pane.classList.add('active');}&lt;/code&gt; If the tab clicked and the text area correspond to each other, it adds the class active. For example, if HTML tab is selected, HTML code text area is made active.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This sets up the tabs to change the code view and update line numbers, when clicked. It's like changing the channel of TV.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;themeToggle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dark-theme&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;appContainer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dark-theme&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.code-input&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;el&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;el&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dark-theme&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.code-area .line-numbers&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dark-theme&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.editor-header .tab.active&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;el&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;el&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dark-theme&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.preview-pane&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dark-theme&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;footer&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dark-theme&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.app-header&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dark-theme&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;This &lt;code&gt;addEventListener('click', function() { ... });&lt;/code&gt; waits for the user to click the theme-toggle button.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;element.classList.toggle('dark-theme')&lt;/code&gt;: This is a JS function, that adds a class name &lt;code&gt;dark-theme&lt;/code&gt; to the element, if not present. If the class name is already there, it removes it.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;document.querySelectorAll(...).forEach(el =&amp;gt; el.classList.toggle(...));&lt;/code&gt;: It toggles the dark mode class for many elements.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes the theme toggle button work and change the styles of elements. This adds a functionality to the house.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;fullScreenToggle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(){&lt;/span&gt;
    &lt;span class="nx"&gt;isFullScreen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;isFullScreen&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;isFullScreen&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
      &lt;span class="nx"&gt;container&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;full-screen&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;container&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;classList&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remove&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;full-screen&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nx"&gt;fullScreenToggle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;innerHTML&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;isFullScreen&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;i class="fas fa-compress"&amp;gt;&amp;lt;/i&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;&amp;lt;i class="fas fa-expand"&amp;gt;&amp;lt;/i&amp;gt;&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt; This &lt;code&gt;addEventListener('click', function() { ... });&lt;/code&gt; waits for the user to click the full-screen-toggle button.&lt;/li&gt;
&lt;li&gt; &lt;code&gt;isFullScreen = !isFullScreen;&lt;/code&gt; If the editor is in full screen, it makes it false. Else, makes it true.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;if(isFullScreen){ ... } else { ...}&lt;/code&gt;: If it is full screen, then add the class &lt;code&gt;full-screen&lt;/code&gt; which applies the full screen styles. Else, it removes it, if already present.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;fullScreenToggle.innerHTML = isFullScreen ? '&amp;lt;i class="fas fa-compress"&amp;gt;&amp;lt;/i&amp;gt;' : '&amp;lt;i class="fas fa-expand"&amp;gt;&amp;lt;/i&amp;gt;';&lt;/code&gt;: This changes the inner text of the fullScreenToggle element, and change the icons to compress or expand, based on if it is fullscreen.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes the fullscreen button to work, and toggles the full screen view.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. Initial setup and first update
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;updateLineNumbers&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nf"&gt;updatePreview&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These lines call the &lt;code&gt;updateLineNumbers()&lt;/code&gt; and &lt;code&gt;updatePreview()&lt;/code&gt; functions immediately when the page loads, which sets up the line numbers and renders the initial page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Concepts
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;DOM Manipulation:&lt;/strong&gt; JavaScript can modify HTML elements and their contents, after the page is loaded.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Event Listeners:&lt;/strong&gt; They watch for user interactions and trigger code in response.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Functions:&lt;/strong&gt; Reusable blocks of code that perform tasks.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Variables:&lt;/strong&gt; Store data to be used and manipulated in the program.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Debouncing:&lt;/strong&gt; Limiting the rate of execution of a particular function.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For, the final, want to see how our code editor looks? It looks pretty clean. Want to see it yourself? Why not? &lt;a href="https://web-dev-free.netlify.app/tools/html-editor/" rel="noopener noreferrer"&gt;Modern HTML, CSS and JS Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqj5s6a12dgi1ta4n88po.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqj5s6a12dgi1ta4n88po.png" alt="Image of Modern HTML, CSS and JS editor by Kavya Sahai" width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>HTTP/2 Protocol</title>
      <dc:creator>Kavya Sahai</dc:creator>
      <pubDate>Tue, 14 Jan 2025 14:16:38 +0000</pubDate>
      <link>https://forem.com/kavya-sahai-god/http2-protocol-2kg6</link>
      <guid>https://forem.com/kavya-sahai-god/http2-protocol-2kg6</guid>
      <description>&lt;p&gt;In the previous posts in the curriculum, we talked about Networking. This is also a part of Networking, and is called by many as HTTP/2 Protocol.&lt;/p&gt;

&lt;h2&gt;
  
  
  HTTP Today
&lt;/h2&gt;

&lt;p&gt;HTTP 1.1 has become a protocol used for virtually everything on the Internet. Significant investments have been made in protocols and infrastructure that leverage this, to the extent that it is often easier today to build things on top of HTTP rather than create something entirely new.&lt;/p&gt;

&lt;h3&gt;
  
  
  The density of HTTP 1.1
&lt;/h3&gt;

&lt;p&gt;When HTTP was initially created and released, it was likely perceived as a simple and straightforward protocol. However, time has proven that perception false. HTTP 1.0, as defined in RFC 1945, was a 60-page specification released in 1996. RFC 2616, which describes HTTP 1.1, was released just three years later in 1999 and had grown significantly to 176 pages. The subsequent update, developed within the IETF, split the specification into six documents, resulting in a much larger total page count (RFC 7230 and family). By any measure, HTTP 1.1 is extensive, including numerous details, subtleties, and a significant number of optional components.&lt;/p&gt;

&lt;h3&gt;
  
  
  A lot of Options
&lt;/h3&gt;

&lt;p&gt;The nature of HTTP 1.1, with its numerous intricate details and options designed for future extensions, has fostered a software ecosystem where virtually no implementation fully implements every aspect of the protocol. Indeed, precisely defining "everything" is even problematic. This has resulted in a situation where features that were initially underutilized received limited implementation support, and those that did implement these features subsequently saw little practical use.&lt;/p&gt;

&lt;p&gt;Subsequently, this created an interoperability challenge when clients and servers began to increase their use of these less common features. HTTP pipelining serves as a prime example of this.&lt;/p&gt;

&lt;h3&gt;
  
  
  Inadequate Utilization of TCP
&lt;/h3&gt;

&lt;p&gt;HTTP 1.1 struggles to fully leverage the potential power and performance that TCP provides. Consequently, HTTP clients and browsers must employ innovative solutions to reduce page load times.&lt;/p&gt;

&lt;p&gt;Parallel efforts over the years have reinforced the difficulty in replacing TCP, thus motivating continued work on improving both TCP itself and the protocols built upon it.&lt;/p&gt;

&lt;p&gt;In essence, TCP's capabilities could be better utilized to minimize pauses or wasted intervals that could otherwise be used for data transmission and reception. The subsequent sections will detail some of these shortcomings.&lt;/p&gt;

&lt;h3&gt;
  
  
  Transfer Sizes and the Number of Objects
&lt;/h3&gt;

&lt;p&gt;An examination of popular websites and the resources required to load their front pages reveals a clear trend. Over time, the volume of data required has steadily increased, reaching and surpassing 1.9 MB. Even more significantly, on average, displaying a single page requires over 100 individual resources.&lt;/p&gt;

&lt;p&gt;As the accompanying graph illustrates, this trend has been consistent for some time, with no indication of any imminent change. The graph demonstrates the growth of the total transfer size (shown in green) and the total number of requests (shown in red) needed, on average, to serve the most popular websites globally over the past four years.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzm1k7kw53j5cpmkelu5q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzm1k7kw53j5cpmkelu5q.png" alt="Transfer size growth" width="800" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Latency Sensitivity
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1z676qaxxxx2y9982851.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1z676qaxxxx2y9982851.png" alt="Latency Kills" width="380" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;HTTP 1.1 exhibits significant latency sensitivity, partly because HTTP pipelining continues to suffer from substantial issues, leading to its widespread deactivation among a large percentage of users.&lt;/p&gt;

&lt;p&gt;While bandwidth availability has increased considerably for many users in recent years, similar improvements in reducing latency have not been observed. High-latency connections, common in many current mobile technologies, impede a satisfactory and rapid web experience, even with high-bandwidth connections.&lt;/p&gt;

&lt;p&gt;Furthermore, low latency is critical for certain real-time video applications, such as video conferencing and gaming, where pre-generated streams are not the sole mode of content delivery.&lt;/p&gt;

&lt;h3&gt;
  
  
  Head-of-Line blocking
&lt;/h3&gt;

&lt;p&gt;HTTP pipelining enables the transmission of subsequent requests while awaiting responses to prior requests. This mechanism bears a notable resemblance to queuing at a service counter, such as in a bank or supermarket. In such scenarios, one cannot predict whether the preceding customer will be served expeditiously or experience significant delays. This inherent limitation is known as head-of-line blocking.&lt;/p&gt;

&lt;p&gt;While one might attempt to select the most promising queue, or even initiate a new queue altogether, ultimately, a decision must be made. Once a queue is chosen, it cannot be changed.&lt;/p&gt;

&lt;p&gt;The creation of a new queue also incurs performance and resource overhead, thus rendering it impractical for scaling beyond a limited number of queues. Consequently, there is no ideal resolution to this problem.&lt;/p&gt;

&lt;p&gt;As a testament to these issues, the majority of desktop web browsers currently ship with HTTP pipelining disabled by default.&lt;/p&gt;

&lt;h2&gt;
  
  
  Addressing Latency Challenges
&lt;/h2&gt;

&lt;p&gt;When confronted with problems, individuals often collaborate to devise workarounds. While some of these workarounds demonstrate ingenuity and utility, others are simply inadequate and poorly conceived solutions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Spriting
&lt;/h3&gt;

&lt;p&gt;"Spriting" is a term commonly used to describe the practice of combining multiple small images into a single, larger image. Subsequently, using either JavaScript or CSS, specific portions of this larger image are extracted and displayed as individual smaller images.&lt;/p&gt;

&lt;p&gt;Websites frequently employ this technique to enhance performance. Retrieving a single, larger image in HTTP 1.1 is significantly faster than retrieving numerous smaller, individual images.&lt;/p&gt;

&lt;p&gt;This technique, however, introduces certain drawbacks. Pages on the website that only require a limited number of the small images incur a penalty for loading the larger combined image. Additionally, spriting results in the simultaneous removal of all sprited images when the cache is cleared, rather than permitting the retention of frequently accessed images.&lt;/p&gt;

&lt;h3&gt;
  
  
  Inlining
&lt;/h3&gt;

&lt;p&gt;"Inlining" represents an alternative technique to circumvent the transmission of individual image files, which involves embedding data URLs directly within a CSS file. This approach yields comparable advantages and disadvantages to the previously described image spriting method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.icon1 {
   background: url(data:image/png;base64,&amp;lt;data&amp;gt;) no-repeat;
}

.icon2 {
   background: url(data:image/png;base64,&amp;lt;data&amp;gt;) no-repeat;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  JavaScript Concatenation
&lt;/h3&gt;

&lt;p&gt;Large websites often accumulate numerous distinct JavaScript files. To mitigate this, developers can employ front-end tools to concatenate, or combine, multiple scripts, thereby enabling browsers to retrieve a single, larger file rather than multiple smaller ones. However, this approach can lead to the transmission of excessive data when only a subset is required, as well as the need to reload substantial amounts of data following even minor modifications.&lt;/p&gt;

&lt;p&gt;This practice primarily presents an inconvenience for the developers involved in the process.&lt;/p&gt;

&lt;h3&gt;
  
  
  Resource Sharding
&lt;/h3&gt;

&lt;p&gt;The final performance technique to be discussed is commonly referred to as "sharding." This involves distributing aspects of a service across as many distinct hosts as possible. While seemingly counterintuitive at first, there is a logical rationale behind this approach.&lt;/p&gt;

&lt;p&gt;The initial HTTP 1.1 specification stipulated a maximum of two TCP connections per host for each client. In order to circumvent this limitation without violating the specification, sophisticated websites employed numerous distinct host names, effectively enabling more concurrent connections and reducing page load times.&lt;/p&gt;

&lt;p&gt;While this limitation has since been removed, with modern clients now typically utilizing six to eight connections per host name, they still operate under a connection limit. Therefore, websites continue to employ resource sharding to further increase the number of concurrent connections. As the volume of objects requested over HTTP continues to rise—as previously illustrated—the increased number of connections is leveraged to enhance HTTP performance and facilitate rapid page loading. It is not uncommon for sites to now utilize well over 50, or even upwards of 100, concurrent connections for a single website by using this approach. Recent data from httparchive.org indicates that the top 300,000 URLs globally require, on average, 40 TCP connections to display the website, and the trend suggests this number is gradually increasing over time.&lt;/p&gt;

&lt;p&gt;Another motivation for resource sharding is to host images and similar resources on a separate host name that does not transmit cookies, as cookie sizes can be substantial. By using cookie-free image hosts, performance can be improved by significantly reducing HTTP request sizes.&lt;/p&gt;

&lt;p&gt;The accompanying figure illustrates a packet trace from browsing a popular Swedish website, demonstrating how requests are distributed across multiple host names.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh4asco8q6ihnstsl2w2j.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh4asco8q6ihnstsl2w2j.jpeg" alt="Image sharding at expressen.se" width="756" height="946"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Updating HTTP
&lt;/h2&gt;

&lt;p&gt;It would be advantageous to develop an improved protocol that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Exhibits reduced latency sensitivity&lt;/li&gt;
&lt;li&gt;Resolves pipelining issues and the head-of-line blocking problem&lt;/li&gt;
&lt;li&gt;Eliminates the need to continually increase the number of connections to each host&lt;/li&gt;
&lt;li&gt;Retains all existing interfaces, content, URI formats, and schemes&lt;/li&gt;
&lt;li&gt;Is developed within the IETF's HTTPbis working group&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Internet Engineering Task Force (IETF) and HTTPbis
&lt;/h3&gt;

&lt;p&gt;The Internet Engineering Task Force (IETF) is an organization responsible for developing and promoting internet standards, primarily at the protocol level. They are widely recognized for the Request for Comments (RFC) series of documents that detail various protocols, such as TCP, DNS, and FTP, as well as best practices, HTTP, and numerous protocol variants, some of which have not seen widespread adoption.&lt;/p&gt;

&lt;p&gt;Within the IETF, dedicated "working groups" are established with specific scopes and objectives. These groups define a "charter" outlining guidelines and limitations for their deliverables. Participation in discussions and development is open to everyone, and all contributions are weighted equally, irrespective of an individual's company affiliation.&lt;/p&gt;

&lt;p&gt;The HTTPbis working group (the name of which will be explained later) was formed in the summer of 2007 with the aim of updating the HTTP 1.1 specification. It was within this group that discussions concerning a next-generation HTTP protocol truly commenced in late 2012. The HTTP 1.1 update was finalized in early 2014, resulting in the RFC 7230 series.&lt;/p&gt;

&lt;p&gt;The concluding interoperability meeting for the HTTPbis working group took place in New York City in early June 2014. Subsequent discussions and adherence to IETF procedures to finalize the official RFC extended into the following year.&lt;/p&gt;

&lt;p&gt;Notably, certain prominent entities within the HTTP field have been absent from working group discussions and meetings. While I will refrain from mentioning specific company or product names, it is apparent that some stakeholders in the current Internet ecosystem are confident that the IETF can achieve success without their direct involvement.&lt;/p&gt;

&lt;h4&gt;
  
  
  Origin of "bis" in HTTPbis
&lt;/h4&gt;

&lt;p&gt;The working group is designated HTTPbis, with the suffix "bis" originating from the Latin adverb for "two." Within the IETF, "bis" is commonly used as a suffix or part of a name to denote an update or a second iteration of a specification; in this particular case, it signifies the update to HTTP 1.1.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP/2's Origins in SPDY
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/SPDY" rel="noopener noreferrer"&gt;SPDY&lt;/a&gt; is a protocol developed and championed by Google. While its development occurred openly with invitations for participation from the broader community, it is evident that Google benefited from controlling both a popular browser implementation and a substantial server infrastructure supporting well-utilized services.&lt;/p&gt;

&lt;p&gt;When the HTTPbis group initiated work on HTTP/2, SPDY had already established itself as a viable concept, demonstrating its deployability across the Internet. Furthermore, published data validated its performance capabilities. The HTTP/2 effort commenced with the SPDY/3 draft, which was subsequently transformed into the HTTP/2 draft-00 through a relatively straightforward find-and-replace process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Core Concepts of HTTP/2
&lt;/h2&gt;

&lt;p&gt;What, then, are the key achievements of HTTP/2? And what were the boundaries established by the HTTPbis group for their development efforts?&lt;/p&gt;

&lt;p&gt;The boundaries imposed were, in fact, quite stringent, placing significant constraints on the team's capacity for innovation. Specifically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTP/2 had to maintain established HTTP paradigms. It remains a protocol where clients transmit requests to servers over TCP.&lt;/li&gt;
&lt;li&gt;http:// and https:// URLs were mandated to remain unchanged, with no new schemes permitted. The vast amount of existing content using these URLs precluded their modification.&lt;/li&gt;
&lt;li&gt;HTTP/1.1 servers and clients are expected to remain in use for decades; therefore, proxying them to HTTP/2 servers is a fundamental requirement.&lt;/li&gt;
&lt;li&gt;Consequently, proxies must be capable of performing one-to-one mappings between HTTP/2 features and HTTP/1.1 clients.&lt;/li&gt;
&lt;li&gt;The removal or reduction of optional protocol components was strongly encouraged. This was not a strict requirement but rather a guiding principle derived from SPDY and the Google team. Ensuring mandatory implementation of all features would prevent future compatibility issues due to partial or selective implementations.&lt;/li&gt;
&lt;li&gt;Minor versions were explicitly disallowed. It was determined that clients and servers would either be fully compatible with HTTP/2 or not at all. Should the need arise to extend or modify the protocol, HTTP/3 would be initiated. HTTP/2 will not include minor version increments.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  HTTP/2's Compatibility with Existing URI Schemes
&lt;/h3&gt;

&lt;p&gt;As previously stated, the existing URI schemes cannot be altered; therefore, HTTP/2 must operate using these existing schemes. Given their current usage with HTTP 1.x, a mechanism is required to upgrade the protocol to HTTP/2 or, alternatively, to explicitly request that a server utilize HTTP/2 rather than older protocols.&lt;/p&gt;

&lt;p&gt;HTTP/1.1 defines the Upgrade: header for this purpose, which enables a server to respond using a new protocol when such a request is received over an older protocol. This, however, incurs the overhead of an additional round-trip.&lt;/p&gt;

&lt;p&gt;This round-trip penalty was deemed unacceptable by the SPDY team, and considering their implementation of SPDY exclusively over TLS, they developed a novel TLS extension to significantly expedite the negotiation process. This extension, termed Next Protocol Negotiation (NPN), allows a server to inform the client which protocols it supports, enabling the client to then select its preferred protocol.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP/2 and TLS
&lt;/h3&gt;

&lt;p&gt;A significant emphasis in HTTP/2 development was placed on ensuring its proper operation over TLS. While SPDY mandated TLS, and there was considerable advocacy for making TLS mandatory for HTTP/2, consensus could not be achieved, and HTTP/2 was ultimately released with TLS as an optional component. However, the lead developers for two leading web browsers—Mozilla Firefox and Google Chrome—have explicitly stated their intention to implement HTTP/2 exclusively over TLS.&lt;/p&gt;

&lt;p&gt;The reasons for opting for TLS-only implementations include a commitment to user privacy and early data demonstrating a higher success rate for these new protocols when used with TLS. This is attributed to the prevalent assumption that traffic on port 80 is exclusively HTTP/1.1, leading some intermediate network devices to interfere with or disrupt traffic when other protocols are used on that port.&lt;/p&gt;

&lt;p&gt;The subject of mandatory TLS has generated considerable debate and strong opinions within mailing lists and meetings—with opinions divided as to its merits and drawbacks. It remains a highly contentious issue, and it is prudent to approach the subject with sensitivity when discussing it with an HTTPbis participant.&lt;/p&gt;

&lt;p&gt;Similarly, a protracted debate has revolved around whether HTTP/2 should mandate a specific list of ciphers when using TLS, or whether it should blacklist certain cipher suites, or whether it should abstain from any requirements concerning the TLS "layer," deferring that to the TLS working group. The final specification stipulates that TLS must be at least version 1.2 and includes cipher suite restrictions.&lt;/p&gt;

&lt;h3&gt;
  
  
  TLS Protocol Negotiation for HTTP/2
&lt;/h3&gt;

&lt;p&gt;Next Protocol Negotiation (NPN) was the initial protocol used to negotiate SPDY connections with TLS servers. Recognizing its limitations as a non-standard protocol, it was submitted to the IETF, resulting in the development of Application Layer Protocol Negotiation (ALPN). ALPN is now the recommended protocol for HTTP/2, while SPDY clients and servers continue to utilize NPN.&lt;/p&gt;

&lt;p&gt;The initial prevalence of NPN and the extended standardization process for ALPN led many early HTTP/2 clients and servers to implement both extensions when negotiating HTTP/2. Furthermore, as NPN is used for SPDY and many servers support both SPDY and HTTP/2, the implementation of both NPN and ALPN on such servers is logically consistent.&lt;/p&gt;

&lt;p&gt;ALPN differs from NPN primarily in the mechanism used to determine the negotiated protocol. With ALPN, the client presents the server with an ordered list of preferred protocols, and the server selects the protocol it will use, whereas with NPN, the client retains the final selection.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP/2 Negotiation over Plain-Text HTTP
&lt;/h3&gt;

&lt;p&gt;As previously noted, when using plain-text HTTP/1.1, the mechanism for negotiating HTTP/2 involves presenting the server with an Upgrade: header. If the server supports HTTP/2, it responds with a "101 Switching Protocols" status, and the connection then operates using HTTP/2. This upgrade procedure, while requiring an additional network round-trip, is offset by the enhanced possibility of maintaining persistent HTTP/2 connections for greater reuse than typical HTTP/1.1 connections.&lt;/p&gt;

&lt;p&gt;While some browser developers have indicated that they will not implement this method of negotiating HTTP/2, the Internet Explorer team once expressed their intent to support it, although this feature was never implemented. The curl utility and a few other non-browser clients do support clear-text HTTP/2.&lt;/p&gt;

&lt;p&gt;Currently, no major web browser supports HTTP/2 without TLS.&lt;/p&gt;

&lt;h2&gt;
  
  
  The HTTP/2 Protocol: A Detailed Examination
&lt;/h2&gt;

&lt;p&gt;With sufficient background established, including the historical context and the political considerations that have led to the current state, we shall now proceed to a detailed examination of the HTTP/2 protocol. This examination will encompass the specific technical elements and concepts that constitute its framework.&lt;/p&gt;

&lt;p&gt;Binary Framing in HTTP/2&lt;/p&gt;

&lt;p&gt;HTTP/2 is a binary protocol.&lt;/p&gt;

&lt;p&gt;This decision warrants a moment of consideration. Those with prior experience in internet protocols might instinctively react negatively to this choice, citing arguments in favor of text-based protocols, particularly their human-readable nature, which allows for manual request crafting using tools like Telnet.&lt;/p&gt;

&lt;p&gt;However, HTTP/2 employs a binary format to simplify framing. Determining the start and end of frames poses a considerable challenge in HTTP/1.1 and, indeed, in text-based protocols generally. By eliminating optional whitespace and multiple ways of representing the same data, implementation complexity is significantly reduced.&lt;/p&gt;

&lt;p&gt;Furthermore, this binary structure facilitates a cleaner separation of the protocol's core components from the framing, an aspect that is confusingly intermixed in HTTP/1.1.&lt;/p&gt;

&lt;p&gt;The inherent compression of HTTP/2, along with its frequent use over TLS, diminishes the utility of text-based protocols since the data is not likely to be transmitted in plaintext. We must, therefore, adapt to using tools such as Wireshark's inspector for accurate protocol-level analysis of HTTP/2.&lt;/p&gt;

&lt;p&gt;Debugging of this protocol will likely require specialized tools like curl or network stream analysis via Wireshark's HTTP/2 dissector and comparable utilities.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Binary Frame Structure
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6g4somfu92gcozxj14oc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6g4somfu92gcozxj14oc.png" alt="Binary Frames" width="400" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;HTTP/2 transmits data using binary frames. Various frame types are defined, each sharing a common structure comprising: Length, Type, Flags, Stream Identifier, and a frame payload.&lt;/p&gt;

&lt;p&gt;The HTTP/2 specification defines ten distinct frame types, with the DATA and HEADERS frames being the most fundamental in their mapping to HTTP/1.1 features. Further details on some of these frame types will be provided subsequently.&lt;/p&gt;

&lt;h3&gt;
  
  
  Multiplexed Streams in HTTP/2
&lt;/h3&gt;

&lt;p&gt;The Stream Identifier, introduced in the preceding section, associates each frame transmitted over HTTP/2 with a specific "stream." A stream is defined as an independent, bidirectional sequence of frames exchanged between the client and server within a single HTTP/2 connection.&lt;/p&gt;

&lt;p&gt;A single HTTP/2 connection can support multiple concurrently open streams, enabling either endpoint to interleave frames from different streams. Streams can be initiated and utilized unilaterally or shared between the client and server, and they can be terminated by either endpoint. The order in which frames are transmitted within a stream is significant, as recipients process frames according to their reception sequence.&lt;/p&gt;

&lt;p&gt;Multiplexing streams involves intermixing data packets from multiple streams over a single connection. Two or more independent data sequences are combined into a single stream and then separated at the receiving end. &lt;/p&gt;

&lt;h3&gt;
  
  
  Stream Priorities and Dependencies
&lt;/h3&gt;

&lt;p&gt;Each stream in HTTP/2 is assigned a priority, also referred to as a "weight," which informs the peer about the relative importance of the stream. This enables a server, in the event of resource constraints, to prioritize the transmission order of streams.&lt;/p&gt;

&lt;p&gt;Through the use of the &lt;code&gt;PRIORITY&lt;/code&gt; frame, a client can also declare a dependency between one stream and another. This mechanism allows for the construction of a hierarchical priority structure, wherein multiple "child streams" may depend on the completion of designated "parent streams."&lt;/p&gt;

&lt;p&gt;These priority weights and dependencies can be dynamically modified at runtime. This allows browsers to specify the relative importance of resources, for example, when users scroll down a page containing numerous images. In this case, the browser can prioritize the download of images currently in view or when switching tabs, a browser can shift focus to a new set of streams that have become active.&lt;/p&gt;

&lt;h3&gt;
  
  
  Header Compression in HTTP/2
&lt;/h3&gt;

&lt;p&gt;HTTP is fundamentally a stateless protocol. This inherent characteristic necessitates that each request contain all the requisite details for the server to process that request, without relying on stored information or metadata from prior requests. As HTTP/2 maintains this paradigm, it operates under the same constraint.&lt;/p&gt;

&lt;p&gt;This stateless nature leads to a degree of redundancy. When a client requests multiple resources from the same server, as is typical with web page images, a series of almost identical requests is generated. Such repetition suggests that compression could be beneficial.&lt;/p&gt;

&lt;p&gt;The increase in the number of objects per web page has been accompanied by a corresponding growth in the size of HTTP requests, driven by factors such as cookie usage. These cookies must also be transmitted in each request, further exacerbating this redundancy.&lt;/p&gt;

&lt;p&gt;The size of HTTP/1.1 requests has become so considerable that they now frequently exceed the initial TCP window, leading to slow transmission due to the requirement of a full round-trip before the complete request can be sent. This provides a further justification for implementing header compression.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Complexities of Compression
&lt;/h3&gt;

&lt;p&gt;HTTPS and SPDY compression have been shown to be vulnerable to BREACH and CRIME attacks. By injecting known text into the data stream and analyzing the corresponding changes in the output, an attacker can potentially ascertain the contents of an encrypted payload.&lt;/p&gt;

&lt;p&gt;Implementing compression for dynamic content within a protocol—without becoming susceptible to these types of attacks—requires careful planning and meticulous execution. This was a central concern for the HTTPbis team.&lt;/p&gt;

&lt;p&gt;The solution they devised is HPACK, Header Compression for HTTP/2, which, as its name suggests, is a compression format specifically designed for HTTP/2 headers. HPACK is being specified in a separate Internet-Draft. This new format, combined with several other countermeasures (such as a bit that prohibits intermediaries from compressing specific headers and optional frame padding), is intended to increase the difficulty of exploiting compression vulnerabilities.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stream Resets in HTTP/2
&lt;/h3&gt;

&lt;p&gt;A notable limitation of HTTP/1.1 is the difficulty in terminating an HTTP message once it has been transmitted with a specified Content-Length. While it is often possible to terminate the underlying TCP connection, this incurs the overhead of renegotiating a new TCP handshake.&lt;/p&gt;

&lt;p&gt;A more efficient solution is to simply terminate the message and initiate a new transmission. This functionality is provided by HTTP/2's RST_STREAM frame, which helps conserve bandwidth and eliminate the need to tear down and re-establish connections.&lt;/p&gt;

&lt;h3&gt;
  
  
  Server Push Mechanism
&lt;/h3&gt;

&lt;p&gt;This feature, also known as "cache push," enables a server to proactively transmit resources to a client that are likely to be requested. If a client requests resource X, the server may anticipate a subsequent request for resource Z and preemptively sends resource Z to the client without it being explicitly requested. This expedites client performance by placing resource Z into its cache, ensuring its availability when needed.&lt;/p&gt;

&lt;p&gt;Server push is a mechanism that clients must explicitly authorize. Even with such authorization, clients retain the ability to promptly terminate any pushed stream using the RST_STREAM frame should a particular resource not be desired.&lt;/p&gt;

&lt;h3&gt;
  
  
  Flow Control Mechanisms in HTTP/2
&lt;/h3&gt;

&lt;p&gt;In HTTP/2, each individual stream has its own advertised flow control window that specifies the amount of data the peer is authorized to transmit. This mechanism exhibits similarities in style and function to flow control in SSH.&lt;/p&gt;

&lt;p&gt;For every stream, both endpoints must inform their peer of the available buffer space for incoming data. The peer is then restricted from transmitting more data than the advertised window size until the flow window is extended. It is important to note that flow control applies exclusively to &lt;code&gt;DATA&lt;/code&gt; frames.&lt;/p&gt;

&lt;h2&gt;
  
  
  Envisioning an HTTP/2 Environment
&lt;/h2&gt;

&lt;p&gt;As HTTP/2 gains adoption, what will the implications be? And indeed, will it achieve widespread adoption?&lt;/p&gt;

&lt;h3&gt;
  
  
  Impact of HTTP/2 on User Experience
&lt;/h3&gt;

&lt;p&gt;HTTP/2 is not yet widely deployed, and as such, the precise outcomes of its implementation remain uncertain. However, drawing upon our observations of SPDY and extrapolating from past and ongoing experiments, we can reasonably speculate about its potential impact.&lt;/p&gt;

&lt;p&gt;HTTP/2 is designed to minimize the number of necessary network round-trips, and through multiplexing and rapid stream termination, it completely circumvents the head-of-line blocking issue.&lt;/p&gt;

&lt;p&gt;It facilitates a large number of parallel streams that exceeds the capabilities of even the most aggressively sharded websites currently in use.&lt;/p&gt;

&lt;p&gt;With the proper application of stream prioritization, it is more likely that clients will receive critical data before less-important data. Consequently, it is anticipated that this will lead to faster page load times and more responsive websites, ultimately providing an enhanced web experience.&lt;/p&gt;

&lt;p&gt;While the magnitude of these improvements is still indeterminate, it is important to note that HTTP/2 is still an emerging technology. Furthermore, we have yet to witness clients and servers optimized to fully exploit the capabilities offered by this new protocol.&lt;/p&gt;

&lt;h3&gt;
  
  
  Implications of HTTP/2 for Web Development
&lt;/h3&gt;

&lt;p&gt;Over time, web developers and development environments have amassed an extensive array of techniques and tools designed to mitigate the limitations of HTTP/1.1. As previously outlined, some of these workarounds were, in fact, a justification for the development of HTTP/2.&lt;/p&gt;

&lt;p&gt;It is anticipated that many of these workarounds, which are now used routinely and often without conscious consideration, will either impede HTTP/2 performance or, at the very least, fail to leverage its advanced capabilities. Specifically, techniques like image spriting and inlining are likely to be counterproductive in HTTP/2, and sharding may be detrimental, as HTTP/2 is designed to benefit from fewer, more efficient connections.&lt;/p&gt;

&lt;p&gt;A significant challenge is that web developers must create and deploy websites that serve both HTTP/1.1 and HTTP/2 clients, at least in the near term. Optimizing performance for all users can prove difficult without the maintenance of two distinct front-end implementations.&lt;/p&gt;

&lt;p&gt;For these reasons, it is likely that some time will pass before the full potential of HTTP/2 is realized.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP/2 Implementations
&lt;/h3&gt;

&lt;p&gt;Attempting to document specific implementations in a text such as this is inherently impractical and will invariably become outdated very quickly. Therefore, instead of detailing specific implementations, I will provide a general overview of the situation and direct readers to the &lt;a href="https://github.com/httpwg/http2-spec/wiki/Implementations" rel="noopener noreferrer"&gt;list of implementations&lt;/a&gt; maintained on the HTTP/2 website.&lt;/p&gt;

&lt;p&gt;A significant number of implementations were developed early in the process, and this number has steadily increased throughout the HTTP/2 development effort. At the time of writing, there are over 40 implementations listed, with the majority conforming to the final specification.&lt;/p&gt;

&lt;h4&gt;
  
  
  HTTP/2 Support in Web Browsers
&lt;/h4&gt;

&lt;p&gt;Firefox has consistently been at the forefront in supporting early drafts of the HTTP/2 protocol. Twitter has also actively adopted HTTP/2, providing its services through the protocol. Google initiated HTTP/2 support in April 2014 on a limited number of test servers and, as of May 2014, integrated HTTP/2 support into its development versions of Chrome. Microsoft has demonstrated a technical preview with HTTP/2 support for its next version of Internet Explorer. Both Safari (with iOS 9 and Mac OS X El Capitan) and Opera have also announced their intention to support HTTP/2.&lt;/p&gt;

&lt;h4&gt;
  
  
  HTTP/2 Support in Web Servers
&lt;/h4&gt;

&lt;p&gt;There is already a significant number of server implementations of HTTP/2 available.&lt;/p&gt;

&lt;p&gt;The popular Nginx server has included HTTP/2 support since version 1.9.5, released on September 22, 2015. This implementation replaces the SPDY module, preventing them from being used concurrently within the same server instance.&lt;/p&gt;

&lt;p&gt;Apache's httpd server has offered HTTP/2 support through the mod_http2 module since version 2.4.17, released on October 9, 2015.&lt;/p&gt;

&lt;p&gt;Furthermore, H2O, Apache Traffic Server, nghttp2, Caddy, and LiteSpeed have all released HTTP/2 capable servers.&lt;/p&gt;

&lt;h4&gt;
  
  
  Other HTTP/2 Implementations and Tools
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;curl&lt;/code&gt; and &lt;code&gt;libcurl&lt;/code&gt; support both insecure and TLS-based HTTP/2 connections, utilizing a variety of different TLS libraries.&lt;/p&gt;

&lt;p&gt;Wireshark also provides support for HTTP/2, making it an ideal tool for analyzing HTTP/2 network traffic.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common Criticisms of HTTP/2
&lt;/h3&gt;

&lt;p&gt;Throughout the development of this protocol, there has been considerable debate, and some stakeholders believe that the final specification is fundamentally flawed. I will now present some of the more common criticisms, along with the counterarguments that have been made against them.&lt;/p&gt;

&lt;h4&gt;
  
  
  Google's Alleged Influence on HTTP/2 Development
&lt;/h4&gt;

&lt;p&gt;A common criticism is that HTTP/2 is designed or controlled by Google, with some variations of this assertion implying that the protocol makes the internet further dependent on or controlled by Google. This is inaccurate. The protocol was developed within the IETF, adhering to the established procedures that have been utilized for over 30 years. However, it is essential to recognize and acknowledge Google's significant contribution through SPDY, which not only demonstrated the feasibility of deploying a new protocol but also provided quantitative data that illustrated the potential performance gains.&lt;/p&gt;

&lt;p&gt;In a public announcement, Google stated their intention to remove support for SPDY and NPN from Chrome in 2016, advocating for a migration of servers to HTTP/2 instead. In February 2016, they further announced that SPDY and NPN would be definitively removed in Chrome 51. Consequently, Chrome versions since 51 have been released without SPDY and NPN support.&lt;/p&gt;

&lt;h4&gt;
  
  
  HTTP/2's Limited Utility Beyond Browsers
&lt;/h4&gt;

&lt;p&gt;There is some validity to the argument that HTTP/2's benefits are primarily geared toward web browsers. A key motivation for the development of HTTP/2 was the resolution of issues related to HTTP pipelining. If a particular use case does not inherently require pipelining, then the adoption of HTTP/2 may not result in significant advantages. While pipelining is not the only improvement within the protocol, it is a notable one.&lt;/p&gt;

&lt;p&gt;However, as services start to fully realize the capabilities offered by multiplexed streams over a single connection, it is likely that we will see increased application of HTTP/2 beyond the browser.&lt;/p&gt;

&lt;p&gt;Small REST APIs and other simple programmatic uses of HTTP/1.x may not find the transition to HTTP/2 to be particularly advantageous, yet the implementation of HTTP/2 should present minimal disadvantages for most users.&lt;/p&gt;

&lt;h4&gt;
  
  
  HTTP/2's Alleged Exclusivity for Large Sites
&lt;/h4&gt;

&lt;p&gt;This assertion is inaccurate. The multiplexing capabilities of HTTP/2 are designed to significantly enhance the user experience on high-latency connections, which are frequently encountered with smaller sites that lack broad geographical distribution. In contrast, larger sites often already benefit from greater speed and distribution, which lead to shorter round-trip times for users.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Binary Nature of HTTP/2 is Unacceptable
&lt;/h4&gt;

&lt;p&gt;It is acknowledged that the human-readable nature of text-based protocols is advantageous for debugging and tracing purposes. However, text-based protocols are also more susceptible to errors, posing greater challenges for parsing and introducing potential parsing issues. Furthermore, binary protocols are designed to be universally accessible across various programming languages, not solely English.&lt;/p&gt;

&lt;p&gt;The concern surrounding the binary nature of HTTP/2 is somewhat mitigated by the fact that the prevalence of TLS and compression in HTTP/1.x already obscures the underlying text format, yet they have been extensively used for many years.&lt;/p&gt;

&lt;h2&gt;
  
  
  Looking Beyond HTTP/2
&lt;/h2&gt;

&lt;p&gt;The development of HTTP/2 involved numerous difficult decisions and compromises. With HTTP/2 deployment underway, a formal mechanism for transitioning to subsequent protocol versions has been established, laying a foundation for future protocol revisions. This also introduces the framework and infrastructure necessary to handle multiple versions concurrently. Perhaps it is no longer necessary to entirely phase out older versions when introducing new ones?&lt;/p&gt;

&lt;p&gt;HTTP/2, however, still retains a significant amount of HTTP/1 "legacy" in order to enable seamless proxying of traffic between HTTP/1.1 and HTTP/2. Some of this legacy may impede further development and innovation. Perhaps HTTP/3 could remove some of these constraints?&lt;/p&gt;

&lt;p&gt;In your opinion, what key features are still lacking in HTTP?&lt;/p&gt;

&lt;h3&gt;
  
  
  Introduction to HTTP/3
&lt;/h3&gt;

&lt;p&gt;QUIC is no longer considered an acronym; it is now established as the name of a transport protocol that operates over UDP. This protocol is documented across four specifications: RFC 8999 through RFC 9002. HTTP/3 is the next iteration of the HTTP protocol currently under development, designed to operate on top of the QUIC protocol.&lt;/p&gt;

&lt;h2&gt;
  
  
  Personal Opinions
&lt;/h2&gt;

&lt;p&gt;While the majority of websites continue to operate on HTTP/1.1, development of HTTP/3, a subsequent generation, is already underway. It is also evident that many web developers and websites are not actively pursuing a transition to HTTP/2 or HTTP/3. This partly explains the continued popularity of services such as Cloudflare.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>AI Solves a 50-Year-Old Physics Mystery You Won't Believe!</title>
      <dc:creator>Kavya Sahai</dc:creator>
      <pubDate>Tue, 07 Jan 2025 19:38:30 +0000</pubDate>
      <link>https://forem.com/kavya-sahai-god/ai-solves-a-50-year-old-physics-mystery-you-wont-believe-3i9e</link>
      <guid>https://forem.com/kavya-sahai-god/ai-solves-a-50-year-old-physics-mystery-you-wont-believe-3i9e</guid>
      <description>&lt;p&gt;Yeah, the title is clickbait; it didn't solve it entirely, but rather, partially, or I should say, it helped solve the problem.&lt;/p&gt;

&lt;p&gt;There's a 47-year-old problem in physics, commonly known as the Quark-Gluon Plasma problem. It's basically this: Where is the onset of deconfinement (1) as a function of temperature and chemical potentials? (2) as a function of relativistic heavy-ion collision energy and system size? What is the mechanism of energy and baryon-number stopping leading to the creation of quark-gluon plasma in relativistic heavy-ion collisions? Why is sudden hadronization and the statistical-hadronization model a near-to-perfect description of hadron production from quark–gluon plasma? Is quark flavor conserved in quark–gluon plasma? Are strangeness and charm in chemical equilibrium in quark–gluon plasma? Does strangeness in quark–gluon plasma flow at the same speed as up and down quark flavors? Why does deconfined matter show ideal flow?&lt;/p&gt;

&lt;p&gt;Google's new AI model, Gemini 2.0 Flash Thinking Experimental—yeah, that's its name—took 3 minutes of reasoning time (to be exact, 3 minutes, 22.8868 seconds) to address this problem. If you didn't know, scientists sometimes, randomly in their free time, like to explore these new models. While testing this same model, this unsolved problem was entered.&lt;/p&gt;

&lt;p&gt;And after about 3 minutes, a response came from the model, one that shocked the person and me personally. If you don't know, I just so happen to have a PhD in Physics from UTSA. Yeah, I'm flexing, what can you do? huh? &lt;/p&gt;

&lt;p&gt;Coming back… It produced the following output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Here are the answers to your questions:

&lt;span class="gs"&gt;**(1) Onset of Deconfinement as a Function of Temperature and Chemical Potentials:**&lt;/span&gt;

The onset of deconfinement, the transition from hadronic matter to a Quark-Gluon Plasma (QGP), is characterized by a boundary in the QCD phase diagram spanned by temperature ($T$) and various chemical potentials. The most relevant chemical potential is the baryon chemical potential ($&lt;span class="se"&gt;\m&lt;/span&gt;u_B$), which is related to the net baryon number density.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**At low $\mu_B$ (e.g., near zero, relevant for LHC energies):**&lt;/span&gt; The transition is believed to be a rapid crossover, not a sharp first-order phase transition. Lattice QCD calculations indicate a pseudo-critical temperature ($T_c$) around $150-160$ MeV. This means that as the temperature increases through this range, the system smoothly transitions from a hadron gas to a QGP.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**At higher $\mu_B$ (relevant for lower collision energies, e.g., RHIC beam energy scan):**&lt;/span&gt; The nature of the transition is less well understood. Theoretical models and some lattice QCD extrapolations suggest the possibility of a first-order phase transition line ending in a critical point ($T_{CP}, &lt;span class="se"&gt;\m&lt;/span&gt;u_{B,CP}$). The exact location of this critical point is a subject of ongoing research. As you increase $&lt;span class="se"&gt;\m&lt;/span&gt;u_B$ at a given temperature, crossing this line would represent a sharp transition to the QGP.

In summary, the onset of deconfinement is not a single point but rather a region or a line in the $(T, &lt;span class="se"&gt;\m&lt;/span&gt;u_B)$ plane. Other chemical potentials, such as the strangeness chemical potential ($&lt;span class="se"&gt;\m&lt;/span&gt;u_S$), also play a role but are generally smaller and constrained by the requirement of zero net strangeness in heavy-ion collisions.

&lt;span class="gs"&gt;**(2) Onset of Deconfinement as a Function of Relativistic Heavy-Ion Collision Energy and System Size:**&lt;/span&gt;

The experimental parameters of relativistic heavy-ion collisions directly influence the temperature and chemical potential reached in the produced matter.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**Collision Energy:**&lt;/span&gt; Higher collision energies generally lead to higher temperatures and lower baryon chemical potentials in the central region. This is because more of the initial kinetic energy of the colliding nuclei is converted into energy density rather than net baryon density. Experiments at the Relativistic Heavy Ion Collider (RHIC) and the Large Hadron Collider (LHC) have explored energies where the created matter is expected to be well above the deconfinement temperature. Lower energy collisions, like those studied in the RHIC beam energy scan or at the Schwerionen-Synchrotron (SIS100/FAIR) and the Nuclotron-based Ion Collider fAcility (NICA), probe regions of the phase diagram with higher $&lt;span class="se"&gt;\m&lt;/span&gt;u_B$.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**System Size:**&lt;/span&gt; Larger colliding nuclei (e.g., Au+Au or Pb+Pb) and more central collisions (where the nuclei overlap fully) lead to:
&lt;span class="p"&gt;    *&lt;/span&gt;   &lt;span class="gs"&gt;**Higher Energy Density:**&lt;/span&gt; More participating nucleons contribute to the energy deposition.
&lt;span class="p"&gt;    *&lt;/span&gt;   &lt;span class="gs"&gt;**Longer Lifetime:**&lt;/span&gt; The larger volume takes longer to expand and cool down, allowing for more time for thermalization and the formation of a QGP.
&lt;span class="p"&gt;    *&lt;/span&gt;   &lt;span class="gs"&gt;**Greater Degree of Thermalization:**&lt;/span&gt; More interactions among the constituents facilitate reaching thermal and chemical equilibrium.

Smaller systems (e.g., p+Pb, d+Au, or even high-multiplicity p+p collisions) may also reach high energy densities, but the timescale and volume might be insufficient for full thermalization and the formation of a large, long-lived QGP. However, evidence for QGP-like behavior in these smaller systems is a current area of intense research.

The onset of deconfinement, therefore, can be mapped to a threshold in collision energy and system size where the conditions (temperature and energy density) are sufficient to transition from hadronic matter to a QGP.

&lt;span class="gs"&gt;**(3) Mechanism of Energy and Baryon-Number Stopping Leading to Creation of Quark-Gluon Plasma:**&lt;/span&gt;

The creation of a QGP in relativistic heavy-ion collisions involves a complex process occurring in the initial moments of the collision. The key mechanisms are:
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**Color Glass Condensate (CGC):**&lt;/span&gt; At very high energies, the gluons inside the colliding nuclei are densely packed, forming a Color Glass Condensate. When the nuclei collide, these dense gluon fields interact strongly.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**Gluon Saturation and Coherent Interactions:**&lt;/span&gt; The high density of gluons leads to saturation, where the rate of gluon splitting balances the rate of gluon fusion. The strong interactions between these gluons are responsible for a significant fraction of the initial energy deposition.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**String Breaking (Flux Tubes):**&lt;/span&gt; As the colliding nuclei pass through each other, colored fields are stretched between the separating nucleons. These stretched fields can be visualized as flux tubes or strings. The energy stored in these strings increases with separation, eventually leading to the creation of quark-antiquark pairs from the vacuum, effectively "breaking" the strings. This process deposits energy into the interaction region.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**Multiple Parton Interactions (MPI):**&lt;/span&gt; Within each nucleon, there are multiple partons (quarks and gluons). Multiple partons from one nucleus can interact with multiple partons from the other nucleus simultaneously. These interactions contribute to the rapid thermalization and energy deposition.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**Baryon Number Transport:**&lt;/span&gt; While a significant amount of energy is deposited in the central region, baryon number transport is less efficient. The net baryon number tends to remain closer to the initial projectile and target nuclei, leading to a higher baryon chemical potential in the forward and backward rapidity regions, while the central region has a lower net baryon density. The mechanisms for baryon number transport are still under investigation, but processes involving diquarks and junction-antijunction pairs are considered.

These processes happen very quickly ($&lt;span class="se"&gt;\s&lt;/span&gt;im 1$ fm/c) and lead to a state of high energy density and temperature, forming the QGP.

&lt;span class="gs"&gt;**(4) Why is Sudden Hadronization and the Statistical-Hadronization Model a Near-to-Perfect Description of Hadron Production from Quark–Gluon Plasma?**&lt;/span&gt;

The success of the Statistical Hadronization Model (SHM) in describing hadron production from the QGP relies on the idea of &lt;span class="gs"&gt;**sudden hadronization**&lt;/span&gt;. This concept suggests that as the QGP expands and cools, the transition back to hadronic matter occurs rapidly at a relatively constant temperature (the hadronization temperature, $T_H &lt;span class="se"&gt;\a&lt;/span&gt;pprox 150-170$ MeV).

Here's why this works and why the SHM is successful:
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**Thermal Equilibrium:**&lt;/span&gt; The QGP is assumed to be in thermal equilibrium before hadronization. This means that the constituents (quarks and gluons) have a well-defined temperature and obey thermal distributions.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**Chemical Equilibrium:**&lt;/span&gt; Crucially, the SHM assumes that at the point of hadronization, the various hadron species are in &lt;span class="gs"&gt;**chemical equilibrium**&lt;/span&gt;. This means that the relative abundances of different hadron types are determined solely by their masses, quantum numbers (like strangeness, baryon number), and the hadronization temperature and chemical potentials. The strong interactions within the QGP drive the system towards this chemical equilibrium.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**Statistical Ensembles:**&lt;/span&gt; The SHM treats hadronization as a process where the available quarks and antiquarks combine statistically to form hadrons. The probability of forming a particular hadron is determined by its Boltzmann factor, $&lt;span class="se"&gt;\e&lt;/span&gt;xp(-E/T_H)$, where $E$ is the hadron's energy and $T_H$ is the hadronization temperature. Chemical potentials are included to account for conserved quantities.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**Loss of Microscopic Details:**&lt;/span&gt; The sudden nature of hadronization means that detailed information about the earlier dynamics of the QGP is largely lost. The system essentially "forgets" the specific history of how it reached the hadronization point. The statistical nature of the process then dictates the hadron yields.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**Fits to Experimental Data:**&lt;/span&gt; The SHM has been remarkably successful in fitting the measured ratios of various hadron species produced in heavy-ion collisions. By adjusting the hadronization temperature and chemical potentials (primarily $&lt;span class="se"&gt;\m&lt;/span&gt;u_B$ and $&lt;span class="se"&gt;\m&lt;/span&gt;u_S$), the model can accurately reproduce the observed particle yields.

While the model doesn't describe the detailed dynamics of hadron formation, its success suggests that the conditions at hadronization are well-described by thermodynamic equilibrium. The rapid nature of the transition prevents significant changes in the relative particle abundances after the system reaches the hadronization temperature.

&lt;span class="gs"&gt;**(5) Is Quark Flavor Conserved in Quark–Gluon Plasma?**&lt;/span&gt;

&lt;span class="gs"&gt;**Yes, quark flavor is conserved in the Quark-Gluon Plasma through strong interactions.**&lt;/span&gt;

The strong force, governed by Quantum Chromodynamics (QCD), conserves flavor quantum numbers (up, down, strange, charm, bottom, top). The fundamental interactions in the QGP are governed by the strong force, involving gluons and quarks. These interactions can change the color of quarks but do not change their flavor.

Weak interactions, which can change quark flavor (e.g., in beta decay), are much weaker and occur on timescales much longer than the lifetime of the QGP produced in heavy-ion collisions. Therefore, for the relevant timescales of QGP evolution and hadronization, flavor is effectively conserved.

&lt;span class="gs"&gt;**(6) Are Strangeness and Charm in Chemical Equilibrium in Quark–Gluon Plasma?**&lt;/span&gt;

The degree of chemical equilibrium for different quark flavors in the QGP depends on the timescale of the processes that produce them and the lifetime of the QGP.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**Strangeness:**&lt;/span&gt; Strangeness production ($s&lt;span class="se"&gt;\b&lt;/span&gt;ar{s}$ pairs) through gluon fusion ($gg &lt;span class="se"&gt;\r&lt;/span&gt;ightarrow s&lt;span class="se"&gt;\b&lt;/span&gt;ar{s}$) and quark-antiquark annihilation ($q&lt;span class="se"&gt;\b&lt;/span&gt;ar{q} &lt;span class="se"&gt;\r&lt;/span&gt;ightarrow s&lt;span class="se"&gt;\b&lt;/span&gt;ar{s}$) is relatively fast in the QGP. The timescale for reaching strangeness chemical equilibrium is estimated to be comparable to or shorter than the lifetime of the QGP in sufficiently hot and dense systems (e.g., at RHIC and LHC). Experimental evidence, such as the enhanced production of strange hadrons, supports the idea of strangeness being close to chemical equilibrium.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**Charm:**&lt;/span&gt; Charm quarks are much heavier than up, down, and strange quarks. Their production primarily occurs in the initial hard scattering processes of the collision. Due to their large mass, the thermal production of charm quarks in the QGP is suppressed. The timescale for charm quarks to reach chemical equilibrium through interactions within the QGP is longer than for light quarks. In smaller or shorter-lived QGP systems, charm might not fully reach chemical equilibrium. However, in larger and longer-lived systems, there is evidence suggesting that charm can approach chemical equilibrium. This is an active area of research.

In summary, &lt;span class="gs"&gt;**strangeness is generally considered to be close to chemical equilibrium in the QGP produced in typical heavy-ion collisions at RHIC and LHC energies.**&lt;/span&gt; &lt;span class="gs"&gt;**Charm, due to its larger mass, may or may not fully equilibrate chemically, depending on the size and lifetime of the QGP.**&lt;/span&gt;

&lt;span class="gs"&gt;**(7) Does Strangeness in Quark–Gluon Plasma Flow at the Same Speed as Up and Down Quark Flavors?**&lt;/span&gt;

&lt;span class="gs"&gt;**Yes, strangeness in the QGP is expected to flow at the same speed as up and down quark flavors.**&lt;/span&gt;

The QGP behaves like a nearly perfect fluid. Hydrodynamic models, which successfully describe the collective flow patterns observed in heavy-ion collisions (like elliptic flow), treat the QGP as a single fluid with a common flow velocity.

Different quark flavors within the QGP are coupled through strong interactions. These interactions are strong enough to ensure that all constituents of the fluid (quarks and gluons) participate in the collective expansion and flow. The pressure gradients in the QGP drive this expansion, and all particle species are subject to these gradients.

Therefore, while the production mechanisms and equilibrium timescales might differ for different flavors, once the QGP is formed, &lt;span class="gs"&gt;**all quark flavors (up, down, strange, and even charm, though to a lesser extent if not fully thermalized) participate in the collective flow pattern with a common velocity field.**&lt;/span&gt; Measurements of elliptic flow for strange hadrons (like $K^0_S$, $&lt;span class="se"&gt;\L&lt;/span&gt;ambda$, $&lt;span class="se"&gt;\X&lt;/span&gt;i$, $&lt;span class="se"&gt;\O&lt;/span&gt;mega$) show similar flow patterns to those of non-strange hadrons, supporting this idea.

&lt;span class="gs"&gt;**(8) Why Does Deconfined Matter Show Ideal Flow?**&lt;/span&gt;

Deconfined matter, the QGP, exhibits near-ideal fluid behavior due to its &lt;span class="gs"&gt;**extremely low shear viscosity to entropy density ratio ($\eta/s$)**&lt;/span&gt;.

Here's why this leads to ideal flow:
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**Shear Viscosity ($\eta$):**&lt;/span&gt; Shear viscosity is a measure of a fluid's resistance to flow. A high viscosity means the fluid is "thick" and experiences significant internal friction, dissipating energy and momentum.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**Entropy Density ($s$):**&lt;/span&gt; Entropy density is a measure of the disorder or the number of degrees of freedom per unit volume.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**$\eta/s$ as a Measure of Fluidity:**&lt;/span&gt; The ratio $&lt;span class="se"&gt;\e&lt;/span&gt;ta/s$ is a dimensionless quantity that characterizes the degree of fluidity. Quantum mechanical calculations and experimental observations suggest that the QGP has an extremely low $&lt;span class="se"&gt;\e&lt;/span&gt;ta/s$, close to the theoretical lower bound predicted by string theory (Kovtun-Son-Starinets bound: $&lt;span class="se"&gt;\e&lt;/span&gt;ta/s &lt;span class="se"&gt;\g&lt;/span&gt;e 1/(4&lt;span class="se"&gt;\p&lt;/span&gt;i) &lt;span class="se"&gt;\h&lt;/span&gt;bar/k_B$).
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**Strong Coupling:**&lt;/span&gt; The low $&lt;span class="se"&gt;\e&lt;/span&gt;ta/s$ of the QGP indicates that it is a strongly coupled plasma. The constituents (quarks and gluons) interact very frequently and strongly. This strong interaction leads to rapid thermalization and a collective behavior dominated by pressure gradients.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**Hydrodynamic Description:**&lt;/span&gt; Hydrodynamic models, which assume ideal or near-ideal fluid behavior (zero or very low viscosity), successfully describe many experimental observables in heavy-ion collisions, particularly the collective flow patterns like elliptic flow ($v_2$). Elliptic flow arises from the initial almond shape of the overlap region in non-central collisions. The pressure gradients are larger in the reaction plane, leading to an anisotropic expansion. The magnitude of $v_2$ is sensitive to the viscosity of the medium. The fact that ideal or near-ideal hydrodynamic models reproduce the measured $v_2$ well implies a low viscosity.
&lt;span class="p"&gt;
*&lt;/span&gt;   &lt;span class="gs"&gt;**"Ideal" as an Approximation:**&lt;/span&gt; It's important to note that "ideal flow" is an approximation. The QGP is not perfectly inviscid. The small but finite viscosity leads to some dissipation and deviations from perfect hydrodynamic behavior. However, compared to ordinary fluids, the viscosity is exceptionally low, hence the term "near-perfect fluid."

In essence, the strong interactions within the QGP lead to rapid momentum transfer and equilibration, resulting in a fluid with very low internal friction and exhibiting flow patterns consistent with ideal hydrodynamics.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It took some approximations, as visible, but it addressed it, approximately. This too was ground-breaking, kind of, as you'd expect it to solve fully, but it did so, approximately. But that too was groundbreaking, because with assumptions, still, no one was able to solve it, let alone grasp what to do? For decades, people had worked on the question but left empty-handed, and a new AI model, which isn't supposed to be that smart, addresses it. We like to say AI models are nowhere near our intelligence, but, from this, it feels like we aren't anywhere near their intelligence.&lt;/p&gt;

&lt;p&gt;The solution has not yet been published in a Physics Journal, but if it were, it might be game-changing. Till then, see ya.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>discuss</category>
    </item>
    <item>
      <title>How does the Internet Work? Part 2</title>
      <dc:creator>Kavya Sahai</dc:creator>
      <pubDate>Wed, 09 Oct 2024 17:12:05 +0000</pubDate>
      <link>https://forem.com/kavya-sahai-god/how-does-the-internet-work-part-2-2lnm</link>
      <guid>https://forem.com/kavya-sahai-god/how-does-the-internet-work-part-2-2lnm</guid>
      <description>&lt;p&gt;In this lesson/post, we'll talk about Networks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction to Bits, Signals, and Packets
&lt;/h2&gt;

&lt;p&gt;The ability to deliver and exchange information over the world's communication networks has revolutionized how people work, play, and live. At the turn of the century, the U.S. National Academy of Engineering listed 20 technologies with the most significant societal impact in the 20th century. This list included life-changing innovations like electrification, the automobile, and the airplane. It also included four communication technologies—radio and television, the telephone, the Internet, and computers—whose technological underpinnings are the focus of this book.&lt;/p&gt;

&lt;p&gt;Surprisingly, the Internet ranked only #13, as it was developed late in the century, and the committee believed its most significant impacts would occur in the 21st century. That prediction seems accurate: the spread of wireless networks and mobile devices, the rise of social networks, and anytime, anywhere communication have changed commerce, social connections, and even driven societal and political changes.&lt;/p&gt;

&lt;p&gt;Communication is fundamental to modern life. It's hard to imagine life without the Internet, its applications, or networked mobile devices. By early 2011, over 5 billion mobile phones were active worldwide, over a billion with "broadband" connectivity – exceeding the number of people with electricity, shoes, toothbrushes, or toilets in 2011!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fufp3kc2aq6ko8ob2ew3z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fufp3kc2aq6ko8ob2ew3z.png" alt="Internet's Impact on Communication and Society" width="800" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Objectives
&lt;/h3&gt;

&lt;p&gt;This post/lesson(whatever you call it) aims to explain how communication networks work. This is worth studying for two reasons:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;to understand the design principles and analysis techniques used in these systems; &lt;/li&gt;
&lt;li&gt;because the technical ideas are relevant to other fields in computer science (CS) and electrical engineering (EE). This makes studying communication systems a great way to learn broadly applicable concepts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At MIT(Massachusetts Institute of Technology), sophomores take such a course, with some exposure to probability and Fourier series.&lt;/p&gt;

&lt;p&gt;Traditionally, "low-level communication" (how information moves across a single link) has been considered an EE topic, while "networking" (building networks of multiple links) has been a CS topic. Traditional digital communication courses rarely address network building, and computer network courses treat communication over physical links as a black box. This book aims to bridge this gap, providing a comprehensive understanding of both aspects.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwien2kt3vrwknvd7b6as.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwien2kt3vrwknvd7b6as.png" alt="Understanding Communication Networks" width="800" height="667"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We'll cover communication systems end-to-end: from the source with information to transmit, to packets (messages broken down for transmission), to bits ("0" or "1"), to signals (analog waveforms sent over links like wires, fiber, radio, or acoustic waves). We'll examine diverse networks: simple point-to-point links, shared media with multiple nodes, and larger multi-hop networks connected to form even bigger networks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Themes
&lt;/h3&gt;

&lt;p&gt;Three challenges are central to digital communication: reliability, sharing, and scalability. This introductory section focuses on the first two.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3m4vzm1t6twy62k4bd8h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3m4vzm1t6twy62k4bd8h.png" alt="Digital Communication" width="800" height="592"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Reliability
&lt;/h4&gt;

&lt;p&gt;Many factors make communication unreliable. We'll study techniques to improve reliability, all of which employ redundancy to achieve reliability with unreliable components, relying on independent component failures.&lt;/p&gt;

&lt;p&gt;The main challenge is overcoming noise, interference, bit errors, packet losses (from uncorrectable errors, queue overflows, or link/software failures), all of which degrade communication quality.&lt;/p&gt;

&lt;p&gt;Besides reliability, speed is also important. Reliability techniques often use redundancy, reducing speed. Many communication systems balance reliability and speed.&lt;/p&gt;

&lt;p&gt;Communication speeds have increased dramatically, from kilobits per second in the early 1980s to 100+ Megabits per second wirelessly and 1-10 Gigabits per second over wired links today.&lt;/p&gt;

&lt;p&gt;We'll explore why communication is unreliable and how to address it, using error-correcting codes, handling inter-symbol interference, retransmission protocols, and fault-tolerant routing.&lt;/p&gt;

&lt;h4&gt;
  
  
  Efficient Sharing
&lt;/h4&gt;

&lt;p&gt;Dedicated links for every node pair are prohibitively expensive. Sharing is essential. We'll study sharing point-to-point links, shared media, and multi-hop networks.&lt;/p&gt;

&lt;p&gt;We'll cover sharing a medium (relevant to Ethernet, WiFi, cellular networks, and satellite networks), modulation/demodulation (transmitting over different frequencies), and medium access control (MAC) protocols (rules governing network node behavior). We'll explore time sharing (each node transmits for a dedicated time) and frequency sharing (dividing bandwidth). Then we'll move on to multi-hop networks, where many communications share links, orchestrated by switches.&lt;/p&gt;

&lt;p&gt;Key questions include how multiple communications share the network, how messages traverse the network, and how to ensure reliable communication across a multi-hop network.&lt;/p&gt;

&lt;p&gt;Sharing techniques and reliability mechanisms determine network efficiency. Efficiency can be framed as minimizing cost for given requirements or maximizing "useful work" (aggregate throughput, throughput variation, and average delay/latency) for a given network. This post focuses on throughput and latency.&lt;/p&gt;

&lt;h4&gt;
  
  
  Scalability
&lt;/h4&gt;

&lt;p&gt;Scalability (designing networks that handle large sizes) is important. This post touches upon it briefly, leaving detailed discussion for later lessons.&lt;/p&gt;

&lt;h3&gt;
  
  
  Outline and Plan
&lt;/h3&gt;

&lt;p&gt;The lesson is divided into four parts: the source, and the abstractions of bits, signals, and packets, studied in that order.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The source&lt;/strong&gt;: We begin with the basics of information, entropy, source coding (data compression), Huffman codes, and the Lempel-Ziv-Welch algorithm.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bits&lt;/strong&gt;: We address overcoming bit errors with error-correcting codes: linear block codes and convolutional codes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Signals&lt;/strong&gt;: We cover modulation/demodulation, modeling signal distortions with linear time-invariant (LTI) channels, time/frequency domain representations, and frequency response of channels/filters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Packets&lt;/strong&gt;: We study medium sharing with MAC protocols, routing in multi-hop networks, and reliable data transport protocols.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Information, Entropy, and the Motivation for Source Codes
&lt;/h2&gt;

&lt;p&gt;Claude Shannon's theory of information (developed in the late 1940s) is a groundbreaking idea that has transformed many technological fields, especially communication systems and networks. This chapter introduces the intuition behind information, defines it mathematically, and links it to entropy, a property of data sources.&lt;/p&gt;

&lt;p&gt;These concepts enable efficient data compression before communication or storage, allowing for recovery of the original data without distortion.  A core idea is &lt;em&gt;source coding&lt;/em&gt;, which maps each symbol from a data source to a &lt;em&gt;codeword&lt;/em&gt; with desirable properties. A message is a sequence of symbols. Our focus is &lt;em&gt;lossless source coding&lt;/em&gt;, where the original message can be perfectly recovered from an uncorrupted transmission.&lt;/p&gt;

&lt;h3&gt;
  
  
  Information and Entropy
&lt;/h3&gt;

&lt;p&gt;Shannon, building on Hartley's work, realized that information can be defined generally, independent of the application or message semantics. Communication involves a sender (S) choosing and sending one of several possible messages to a receiver (R). For example, S could indicate the British arrival route:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"1" if by land&lt;/li&gt;
&lt;li&gt;"2" if by sea&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If each choice is equally likely (no prior knowledge), the information conveyed is 1 bit. This bit can encode the choice.  1000 such independent events can be encoded with 1000 bits.&lt;/p&gt;

&lt;p&gt;If prior knowledge suggests a higher probability for one choice (e.g., land due to a storm), then the less likely message (sea) conveys more information.  Similarly, a temperature of 75°F in Boston in January is more informative than 32°F.&lt;/p&gt;

&lt;p&gt;Information about an event depends on its probability (p). Lower probability (less likely event) implies higher information.&lt;/p&gt;

&lt;h4&gt;
  
  
  Definition of information
&lt;/h4&gt;

&lt;p&gt;Hartley defined information (I) as:&lt;/p&gt;

&lt;p&gt;I = log(1/p) = -log(p)  (2.1)&lt;/p&gt;

&lt;p&gt;The base-2 logarithm is used, and the unit of information is a bit.  The logarithmic function ensures &lt;em&gt;additivity&lt;/em&gt;:  information from two independent events A and B (probabilities pA and pB) adds up:&lt;/p&gt;

&lt;p&gt;IA + IB = log(1/pA) + log(1/pB) = log(1/(pA*pB)) = log(1/P(A and B))&lt;/p&gt;

&lt;h4&gt;
  
  
  Examples
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9nlcr4i5bredp3sg8kbp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9nlcr4i5bredp3sg8kbp.png" alt="Information Content of Decimal Digit Events" width="800" height="626"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Entropy
&lt;/h4&gt;

&lt;p&gt;Entropy (H) quantifies the expected information from a set of mutually exclusive events. If event &lt;em&gt;i&lt;/em&gt; has probability pi:&lt;/p&gt;

&lt;p&gt;H(p1, p2, ... pN) = Σ pi * log(1/pi)   (2.2)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqwbj2rxixp5deixm63bb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqwbj2rxixp5deixm63bb.png" alt="Solving Process of the Equation above" width="800" height="108"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Entropy is measured in bits and represents the average uncertainty. For two mutually exclusive events with probabilities p and 1-p:&lt;/p&gt;

&lt;p&gt;H(p, 1-p) = -p*log(p) - (1-p)*log(1-p)   (2.3)&lt;/p&gt;

&lt;p&gt;H(p) is symmetric around p = 1/2, with a maximum of 1 bit at p = 1/2. H(0) = H(1) = 0.  Entropy is always non-negative and H(p1, p2, ... pN) ≤ log N.&lt;/p&gt;

&lt;h3&gt;
  
  
  Source Codes
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Source coding&lt;/em&gt; efficiently encodes messages.  Many messages have standard encodings (ASCII, image pixels, audio samples). These are fixed-length encodings, easily manipulated.&lt;/p&gt;

&lt;p&gt;However, these encodings can be inefficient.  In English text, 'e' occurs more frequently than 'x'. Encoding 'e' with fewer bits and 'x' with more bits can shorten the average message length.  This aligns with the information concept: frequent symbols (higher pi) convey less information and need fewer bits.&lt;/p&gt;

&lt;p&gt;A &lt;em&gt;code&lt;/em&gt; maps information to bit sequences. A &lt;em&gt;codeword&lt;/em&gt; is a bit sequence in the code. &lt;em&gt;Source codes&lt;/em&gt; aim to compress data by matching encoded message length to the information content (entropy).&lt;/p&gt;

&lt;p&gt;Example: encoding 1000 grades (A, B, C, D) with probabilities:&lt;/p&gt;

&lt;p&gt;Fixed-length encoding: 2 bits/grade (total 2000 bits).  Decoding is simple, but inefficient.&lt;/p&gt;

&lt;p&gt;Variable-length encoding (example): A=10, B=0, C=110, D=111.  Length depends on the message.  Decoding requires sequential processing.  This example code is not optimal.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Much Compression Is Possible?
&lt;/h3&gt;

&lt;p&gt;Ideally, compression uses only the necessary bits to represent the information. Entropy (Equation 2.2) provides the lower bound on the average number of bits needed to avoid ambiguity. Sending fewer bits leads to unresolved choices at the receiver.&lt;/p&gt;

&lt;p&gt;In the grades example, the expected information per grade is 1.626 bits.  Encoding 1000 grades requires 1626 bits on average. The example variable-length code uses 1667 bits, so it's not optimal.  Encoding sequences of grades can improve compression.&lt;/p&gt;

&lt;p&gt;Finding good codes is challenging. Sometimes, context-specific codes can be very efficient (e.g., encoding Shakespeare sonnets using just 8 bits if both sender and receiver know all the sonnets).&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Compression?
&lt;/h3&gt;

&lt;p&gt;Compression offers several advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Faster transmission:&lt;/strong&gt; Shorter messages reduce transmission time and free up network capacity.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Efficient resource use:&lt;/strong&gt; Smaller messages conserve network resources (bandwidth, buffers), accommodating more communications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Improved throughput over error-prone links:&lt;/strong&gt; Compression before error-correction coding allows for optimized redundancy for error resilience.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Compression is typically an end-to-end function (application layer), but can also be applied at the link layer if the data is compressible and contains redundancy.  The next chapter covers Huffman Codes and Lempel-Ziv-Welch (LZW) compression.&lt;/p&gt;

&lt;h2&gt;
  
  
  Compression Algorithms: Huffman and Lempel-Ziv-Welch (LZW)
&lt;/h2&gt;

&lt;p&gt;This chapter discusses two source coding algorithms for message compression (where a message is a sequence of symbols): Huffman coding and Lempel-Ziv-Welch (LZW). Huffman coding is efficient when symbol probabilities are known and independent. LZW is adaptive, requiring no prior knowledge of probabilities.  Both are widely used (GIF, JPEG, MPEG, MP3, etc.).&lt;/p&gt;

&lt;h3&gt;
  
  
  Properties of Good Source Codes
&lt;/h3&gt;

&lt;p&gt;A &lt;em&gt;code&lt;/em&gt; maps symbols from an alphabet (text, pixel intensities, or abstract symbols) to &lt;em&gt;codewords&lt;/em&gt;.  Binary codewords are convenient for many communication channels.&lt;/p&gt;

&lt;p&gt;Example: Encoding grades in 6.02: A=1, B=01, C=000, D=001. A sequence of grades could be transmitted as 0010001110100001, decoded as "DCAAABCB".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Instantaneous codes:&lt;/strong&gt; A symbol is decoded as soon as its codeword is received.  The grade encoding above is instantaneous. Non-instantaneous codes require looking ahead or decoding from the end, making them harder to decode.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code trees and prefix-free codes:&lt;/strong&gt; A &lt;em&gt;code tree&lt;/em&gt; visualizes codes.  In a binary code tree, edges are labeled with 0 or 1. The path from the root to a symbol gives its encoding.  &lt;em&gt;Prefix-free codes&lt;/em&gt; have symbols only at leaf nodes, ensuring no codeword is a prefix of another. Prefix-free codes are instantaneous.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Expected code length (L):&lt;/strong&gt; For &lt;em&gt;N&lt;/em&gt; symbols with probabilities &lt;em&gt;pi&lt;/em&gt; and codeword lengths &lt;em&gt;li&lt;/em&gt;: L = Σ pi * li.  Codes with small L are desirable for compression. An &lt;em&gt;optimal code&lt;/em&gt; has minimum L. Shannon showed that L ≥ H (entropy), and codes achieving entropy asymptotically exist.&lt;/p&gt;

&lt;h3&gt;
  
  
  Huffman Codes
&lt;/h3&gt;

&lt;p&gt;Huffman codes provide efficient encoding given symbol probabilities.  More likely symbols get shorter codes.&lt;/p&gt;

&lt;p&gt;Huffman's algorithm builds the code tree bottom-up, starting with the least probable symbols:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Input: Set &lt;em&gt;S&lt;/em&gt; of (probability, symbol) tuples.&lt;/li&gt;
&lt;li&gt;Combine the two least probable symbols into a new tuple (combined symbol, sum of probabilities). Add the new tuple to &lt;em&gt;S&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;Repeat step 2 until &lt;em&gt;S&lt;/em&gt; has only one tuple (the root).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The resulting code tree defines the variable-length code.&lt;/p&gt;

&lt;h4&gt;
  
  
  Properties of Huffman Codes
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Non-uniqueness:&lt;/strong&gt; Multiple optimal codes (and trees) may exist due to arbitrary tie-breaking during tree construction.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optimality:&lt;/strong&gt; Huffman codes have minimal expected length among instantaneous codes for independent symbols drawn from a fixed, known probability distribution.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  LZW: An Adaptive Variable-length Source Code
&lt;/h3&gt;

&lt;p&gt;Simple Huffman coding based on letter probabilities has limitations.  Adaptive encoding, which adjusts to the message content, can perform better.  LZW is a popular adaptive algorithm.&lt;/p&gt;

&lt;p&gt;LZW builds a string table mapping symbol sequences to/from &lt;em&gt;N&lt;/em&gt;-bit indices. The table (2^N entries) is initialized with single-byte sequences (0-255).  Encoding:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Accumulate bytes while the sequence (S) is in the table.&lt;/li&gt;
&lt;li&gt;When S + next byte (b) is not in the table:

&lt;ul&gt;
&lt;li&gt;Transmit the code for S.&lt;/li&gt;
&lt;li&gt;Add S + b to the table.&lt;/li&gt;
&lt;li&gt;Reset S to b.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Repeat until all bytes are processed; then transmit the code for the final S.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The decoder rebuilds the table as it receives codes, enabling it to recover the original message.&lt;/p&gt;

&lt;p&gt;LZW observations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Greedy:&lt;/strong&gt; Finds longest matches.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Adaptive:&lt;/strong&gt;  Table entries reflect actual message sequences.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Suboptimal:&lt;/strong&gt;  May include unused entries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Variable compression:&lt;/strong&gt;  Compression increases as the table fills.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Table reinitialization:&lt;/strong&gt;  The table is reset when full, adapting to changing probabilities.  Some variants use a CLEAR code for explicit resets.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Digital? Communication Abstractions and Digital Signaling
&lt;/h2&gt;

&lt;p&gt;This chapter explains analog and digital communication, focusing on the problems with analog and the rationale for digital. It presents methods for sending and receiving digital data over analog communication links (necessary because physical links are fundamentally analog at the lowest level). It also introduces a layered communication model: messages → packets → bits → signals, which forms the basis for the rest of the book.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sources of Data
&lt;/h3&gt;

&lt;p&gt;Communication technologies enable users (human or application) to exchange messages.  Data sources can be inherently digital (e.g., computer-generated data) or analog (e.g., video, audio, sensor data).  Modern systems often digitize all data, regardless of the source.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Digital?
&lt;/h3&gt;

&lt;p&gt;Digital communication excels for two reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Modularity:&lt;/strong&gt;  The digital abstraction enables building large systems by composing modules.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sophisticated Processing:&lt;/strong&gt; It allows using algorithms to enhance data quality and system performance.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;However, physical links are analog, requiring digital-to-analog and analog-to-digital conversions.&lt;/p&gt;

&lt;h4&gt;
  
  
  Why analog is natural in many applications
&lt;/h4&gt;

&lt;p&gt;Analog representations map well to physical link properties. Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Black-and-white TV:&lt;/strong&gt; Image luminance (shade of gray) is represented by voltage levels (0V = black, 1V = white).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Analog telephone:&lt;/strong&gt; Sound waves are converted to electrical signals.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Analog signals can be sent at different voltage/intensity/wavelength levels, easily measured by the receiver.&lt;/p&gt;

&lt;h4&gt;
  
  
  So why not analog?
&lt;/h4&gt;

&lt;p&gt;No communication link is error-free. Noise and distortions perturb signals, and these errors accumulate across multiple transmission stages (cascading effect). This makes analog systems difficult to build reliably, especially complex ones. Digital signaling addresses this problem.&lt;/p&gt;

&lt;h3&gt;
  
  
  Digital Signaling: Mapping Bits to Signals
&lt;/h3&gt;

&lt;p&gt;Digital signaling uses discrete values to represent bits, enabling robust distinction from noise. &lt;em&gt;Binary signaling&lt;/em&gt; uses two voltages: V0 for "0" and V1 for "1".  V0 and V1 must be sufficiently separated to handle noise.&lt;/p&gt;

&lt;p&gt;The receiver uses a threshold voltage (Vth = (V0 + V1) / 2) to map received voltages to bits (voltage &amp;lt; Vth → "0", voltage ≥ Vth → "1").  Precisely measuring near Vth is difficult, but not crucial if V0 and V1 are far apart.&lt;/p&gt;

&lt;h4&gt;
  
  
  Signals in this lesson
&lt;/h4&gt;

&lt;p&gt;Transmission signals are fixed-voltage waveforms held for a specific time.  Continuous signals are represented by discrete-time samples. The &lt;em&gt;sample rate&lt;/em&gt; (samples per second) is agreed upon by sender and receiver. &lt;em&gt;Sample interval&lt;/em&gt; is the time between samples.&lt;/p&gt;

&lt;h4&gt;
  
  
  Clocking Transmissions
&lt;/h4&gt;

&lt;p&gt;Sender and receiver must agree on a clock rate. Bits are sent on clock transitions. &lt;em&gt;Samples_per_bit&lt;/em&gt; is the number of samples per bit. The receiver infers clock edges from transitions in received samples.&lt;/p&gt;

&lt;p&gt;Challenges:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Clock synchronization:&lt;/strong&gt; Sender and receiver clocks may differ.  Solution: Adaptive timing at the receiver based on detected transitions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ensuring frequent transitions:&lt;/strong&gt; Needed for clock recovery. Solution: &lt;em&gt;Line coding&lt;/em&gt; (e.g., 8b/10b).&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Clock and Data Recovery
&lt;/h3&gt;

&lt;p&gt;Receiver clock may be slightly faster or slower than the sender's.  The receiver dynamically adjusts its sampling index based on transitions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the halfway sample between current and previous points is the &lt;em&gt;same&lt;/em&gt; as the current sample (sampling too late): Increment the index by samples_per_bit - 1.&lt;/li&gt;
&lt;li&gt;If the halfway sample is &lt;em&gt;different&lt;/em&gt; (sampling too early): Increment by samples_per_bit + 1.&lt;/li&gt;
&lt;li&gt;If no transition: Increment by samples_per_bit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Initial correction is aided by a training sequence of alternating 0s and 1s at the start of transmission.&lt;/p&gt;

&lt;h3&gt;
  
  
  Line Coding with 8b/10b
&lt;/h3&gt;

&lt;p&gt;8b/10b addresses DC balance and frequent transitions. It maps 8-bit symbols to 10-bit transmission symbols, ensuring:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Maximum run of 0s or 1s is 5 bits.&lt;/li&gt;
&lt;li&gt;Maximum difference between 1s and 0s count at any sample is 6.&lt;/li&gt;
&lt;li&gt;Special 7-bit sequences enable packet boundary detection.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Encoding process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Packet data is divided into bytes.&lt;/li&gt;
&lt;li&gt;Each byte is mapped to a 10-bit symbol.&lt;/li&gt;
&lt;li&gt;Packets are framed with a training sequence and a SYNC pattern for synchronization.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Communication Abstractions
&lt;/h3&gt;

&lt;p&gt;A communication system involves several modules: Mapper (bits to signals), Demapper (signals to bits), Channel coding (error correction), Channel decoding. Messages are broken into packets and transmitted over multiple links.  The three key abstractions are &lt;em&gt;packets&lt;/em&gt;, &lt;em&gt;bits&lt;/em&gt;, and &lt;em&gt;signals&lt;/em&gt;.  The book focuses on these and their interactions within the communication network.&lt;/p&gt;

&lt;h2&gt;
  
  
  Coping with Bit Errors using Error Correction Codes
&lt;/h2&gt;

&lt;p&gt;This chapter discusses techniques for reliable digital communication, focusing on adding redundancy to combat inevitable bit errors in communication channels and storage media.  The core concept is &lt;em&gt;channel coding&lt;/em&gt;: encoding at the sender and decoding at the receiver to correct errors or detect uncorrectable errors.  The chapter focuses on error &lt;em&gt;correction&lt;/em&gt; codes, specifically linear block codes and (later) convolutional codes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Bit Errors and BSC
&lt;/h3&gt;

&lt;p&gt;The &lt;em&gt;Binary Symmetric Channel (BSC)&lt;/em&gt; model characterizes bit errors with a single parameter, ε (bit-flip probability), where a transmitted bit flips with probability ε, independently of other bits. ε can be estimated empirically.  Packet error probability (PER) for a packet of size &lt;em&gt;S&lt;/em&gt; bits:&lt;/p&gt;

&lt;p&gt;PER = 1 - (1 - ε)^S   (5.1)&lt;/p&gt;

&lt;p&gt;When ε &amp;lt;&amp;lt; 1: PER ≈ Sε   (5.2)&lt;/p&gt;

&lt;p&gt;Real-world channels may exhibit &lt;em&gt;burst errors&lt;/em&gt; where error probability depends on history (higher if recent bits were also in error).&lt;/p&gt;

&lt;h3&gt;
  
  
  The Simplest Code: Repetition
&lt;/h3&gt;

&lt;p&gt;A &lt;em&gt;repetition code&lt;/em&gt; encodes bit &lt;em&gt;b&lt;/em&gt; as &lt;em&gt;n&lt;/em&gt; copies of &lt;em&gt;b&lt;/em&gt;. The &lt;em&gt;code rate&lt;/em&gt; is 1/&lt;em&gt;n&lt;/em&gt;.  &lt;em&gt;Maximum likelihood decoding&lt;/em&gt; selects the most likely message given the received codeword. For a BSC, this means choosing the codeword with the most bits in common with the received one.&lt;/p&gt;

&lt;p&gt;Decoding error probability for repetition code (see Equation 5.3 in the original text). The probability decreases exponentially with the code rate but is inefficient due to high overhead.&lt;/p&gt;

&lt;h3&gt;
  
  
  Embeddings and Hamming Distance
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Hamming distance (HD)&lt;/em&gt; between two n-bit words is the number of differing bit positions. For single error correction (SEC), HD between any two valid codewords must be at least 3.  A code with minimum Hamming distance &lt;em&gt;D&lt;/em&gt; can detect &lt;em&gt;D&lt;/em&gt;-1 errors and correct floor(&lt;em&gt;D&lt;/em&gt;/2 -1) errors.&lt;/p&gt;

&lt;h3&gt;
  
  
  Linear Block Codes and Parity Calculations
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Linear block codes&lt;/em&gt; (n, k) map k-bit messages to n-bit codewords using linear functions (weighted sums) over message bits. &lt;em&gt;Algebraic block codes&lt;/em&gt; perform such operations within the block.  (n,k,d) codes denote block codes with a minimum Hamming distance 'd'. Code rate = k/n.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Linear codes&lt;/em&gt; require that the sum of any two codewords is also a codeword.  The all-zeros codeword exists in any linear code. The minimum Hamming distance of a linear block code equals the smallest non-zero codeword's weight (number of 1s).  &lt;em&gt;Binary linear codes&lt;/em&gt; use modulo-2 arithmetic (Galois Field F2).&lt;/p&gt;

&lt;h3&gt;
  
  
  Rectangular Parity SEC Code
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Parity&lt;/em&gt; is the modulo-2 sum of bits. &lt;em&gt;Even parity code&lt;/em&gt; adds a parity bit to each message, making the codeword have even parity. This detects single errors (HD=2).&lt;/p&gt;

&lt;p&gt;The &lt;em&gt;rectangular parity code&lt;/em&gt; arranges k bits into an r x c array and adds row and column parities. Codeword: message + row parities + column parities. Length: n = rc + r + c. This code is an SEC code (HD=3).  Decoding involves checking row and column parities and correcting the corresponding bit if both parities indicate an error.&lt;/p&gt;

&lt;h3&gt;
  
  
  How many parity bits are needed in an SEC code?
&lt;/h3&gt;

&lt;p&gt;Any linear code can be converted to a &lt;em&gt;systematic code&lt;/em&gt; (message bits followed by parity bits). For SEC, the number of parity combinations (2^(n-k)) must be greater than or equal to the number of correctable situations (n+1):&lt;/p&gt;

&lt;p&gt;n + 1 ≤ 2^(n-k)     (5.6)&lt;/p&gt;

&lt;p&gt;Parity bit count grows at least logarithmically with message bits.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hamming Codes
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Hamming codes&lt;/em&gt; are efficient SEC codes with logarithmic parity bit growth.  Each parity bit protects multiple data bits, and single errors produce unique parity error combinations.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Syndrome bits (Ei)&lt;/em&gt; are computed at the receiver by checking parities. The combination of syndrome bits indicates the erroneous bit (if any).&lt;/p&gt;

&lt;h4&gt;
  
  
  Is There a Logic to the Hamming Code Construction?
&lt;/h4&gt;

&lt;p&gt;Hamming code construction:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Assign parity bits to indices that are powers of 2 (1, 2, 4, 8,...).&lt;/li&gt;
&lt;li&gt;Assign data bits to remaining indices.&lt;/li&gt;
&lt;li&gt;Data bit &lt;em&gt;di&lt;/em&gt; is included in the parity computation for &lt;em&gt;pj&lt;/em&gt; if and only if index(&lt;em&gt;pj&lt;/em&gt;) contributes to index(&lt;em&gt;di&lt;/em&gt;) in binary representation (bitwise AND is non-zero).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The syndrome bits (E3E2E1 in the (7,4) example) treated as a binary number give the index of the bit to correct.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note: This is just the information, one needs for Web Development. For Sysops, the networks and their fundamentals are a two-semester course.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>How does the internet work? Part 1</title>
      <dc:creator>Kavya Sahai</dc:creator>
      <pubDate>Sat, 05 Oct 2024 13:27:52 +0000</pubDate>
      <link>https://forem.com/kavya-sahai-god/how-does-the-internet-work-part-1-279f</link>
      <guid>https://forem.com/kavya-sahai-god/how-does-the-internet-work-part-1-279f</guid>
      <description>&lt;p&gt;Ever wonder what happens when you click a link? 🌐 How The Internet Works takes you behind the scenes of the digital world, breaking down complex tech into simple, bite-sized insights. From data packets to servers and beyond, discover the magic that powers your online experience! (Hook written with the help of AI, because I can't :D)&lt;/p&gt;

&lt;h2&gt;
  
  
  What happens when you go to google.com?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The "g" key is pressed
&lt;/h3&gt;

&lt;p&gt;Let me explain the physical keyboard actions and the OS interrupts. When you press the "g" key, the browser registers the event, triggering the auto-complete functions. Based on your browser's algorithm and whether you're in regular or private/incognito mode, various suggestions appear in a dropdown beneath the URL bar. &lt;/p&gt;

&lt;p&gt;These suggestions are typically prioritized and sorted using factors such as your search history, bookmarks, cookies, and popular internet searches. As you continue typing "google.com," numerous processes run in the background, and the suggestions refine with each keystroke. The browser might even predict "google.com" before you've finished typing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frtn7jmyysay7wvwalqi6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frtn7jmyysay7wvwalqi6.png" alt="Autocomplete Sequence" width="800" height="606"&gt;&lt;/a&gt;&lt;br&gt;
Browsing Autocomplete Sequences&lt;/p&gt;

&lt;p&gt;The "enter" key bottoms out&lt;/p&gt;

&lt;p&gt;To establish a starting point, let's consider the Enter key on a keyboard when it reaches the bottom of its travel range. At this moment, an electrical circuit dedicated to the Enter key is closed (either mechanically or capacitively), allowing a small current to flow into the keyboard's logic circuitry. This circuitry scans the state of each key switch, filters out electrical noise from the rapid closure of the switch (debouncing), and translates the action into a keycode—in this case, the integer 13. The keyboard controller then encodes this keycode for transmission to the computer. Today, this is almost always done over a Universal Serial Bus (USB) or Bluetooth connection, though older systems used PS/2 or ADB.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In the case of a USB keyboard&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The keyboard is powered by a 5V supply delivered through pin 1 of the computer's USB host controller.&lt;/li&gt;
&lt;li&gt;The keycode generated by the keypress is stored in an internal register known as the "endpoint."&lt;/li&gt;
&lt;li&gt;The USB host controller polls this "endpoint" roughly every 10ms (the minimum interval set by the keyboard), retrieving the stored keycode.&lt;/li&gt;
&lt;li&gt;The keycode is sent to the USB Serial Interface Engine (SIE), where it is converted into one or more USB packets in accordance with the USB protocol.&lt;/li&gt;
&lt;li&gt;These packets are transmitted over the D+ and D- lines (the two middle pins) at a maximum rate of 1.5 Mb/s, as the keyboard is classified as a "low-speed device" (per USB 2.0 standards).&lt;/li&gt;
&lt;li&gt;The computer's host USB controller decodes this serial signal, and the Human Interface Device (HID) driver interprets the keypress. Finally, the key event is passed to the operating system's hardware abstraction layer.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9c2odnfsch9tdg4hazt0.png" alt="Sequence Diagram in case of USB Keyboard" width="800" height="391"&gt;
Sequence Diagram&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;In the case of a virtual keyboard (such as on touch screen devices)&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When the user touches a capacitive touch screen, a small amount of current transfers to their finger. This interaction disturbs the electrostatic field of the screen’s conductive layer, creating a voltage drop at the point of contact.&lt;/li&gt;
&lt;li&gt;The screen controller detects this and triggers an interrupt, reporting the coordinates of the touch.&lt;/li&gt;
&lt;li&gt;The operating system then alerts the currently active application that a press event has occurred within its graphical interface, typically on a virtual keyboard button.&lt;/li&gt;
&lt;li&gt;The virtual keyboard application raises a software interrupt, which notifies the operating system of a "key pressed" event.&lt;/li&gt;
&lt;li&gt;The focused application receives this notification and processes the keypress accordingly.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm2id13v4a4q35x8mb7s7.png" alt="Sequence Diagram in case of a Virtual Keyboard." width="800" height="316"&gt;
Sequence Diagram Describing the same&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Interrupt Fires [Not for USB Keyboards]
&lt;/h3&gt;

&lt;p&gt;For non-USB keyboards, such as those using legacy connections (e.g., PS/2), the keyboard signals an interrupt via its interrupt request line (IRQ). This IRQ is mapped to an interrupt vector (an integer) by the system's interrupt controller. The CPU consults the Interrupt Descriptor Table (IDT), which links each interrupt vector to a corresponding function known as an interrupt handler, supplied by the operating system’s kernel.&lt;/p&gt;

&lt;p&gt;When the interrupt is triggered, the CPU uses the interrupt vector to index into the IDT and execute the appropriate interrupt handler. This process causes the CPU to transition into kernel mode, allowing the operating system to manage the keypress event.&lt;/p&gt;
&lt;h3&gt;
  
  
  A WM_KEYDOWN Message is Sent to the App (On Windows)
&lt;/h3&gt;

&lt;p&gt;When the Enter key is pressed, the Human Interface Device (HID) transport passes the key down event to the KBDHID.sys driver, which converts the HID usage data into a scan code. In this case, the scan code is VK_RETURN (0x0D), representing the Enter key. The KBDHID.sys driver then communicates with the KBDCLASS.sys driver (the keyboard class driver), which securely manages all keyboard input. Before proceeding, the signal may pass through any third-party keyboard filters installed on the system, though this also happens in kernel mode.&lt;/p&gt;

&lt;p&gt;Next, Win32K.sys comes into play, determining which window is currently active by invoking the GetForegroundWindow() API. This function retrieves the window handle (hWnd) of the active application, such as the browser’s address bar. At this point, the Windows "message pump" calls SendMessage(hWnd, WM_KEYDOWN, VK_RETURN, lParam). The lParam parameter contains a bitmask that provides additional information about the keypress, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Repeat count&lt;/strong&gt; (which is 0 in this case),&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scan code&lt;/strong&gt; (which might be OEM-specific but typically standard for VK_RETURN),&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Extended key flags&lt;/strong&gt; (indicating whether modifier keys like Alt, Shift, or Ctrl were also pressed, which they weren’t).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The SendMessage API queues the message for the specific window handle. Later, the system’s main message processing function (known as WindowProc) assigned to the window (hWnd) retrieves and processes messages in the queue.&lt;/p&gt;

&lt;p&gt;The active window in this case is an edit control, and its WindowProc function has a message handler that responds to WM_KEYDOWN events. The handler checks the third parameter (wParam) passed by SendMessage, recognizes that the value is VK_RETURN, and thus determines that the user has pressed the Enter key. This triggers the appropriate response for the application.&lt;/p&gt;
&lt;h3&gt;
  
  
  A KeyDown NSEvent is Sent to the App (On OS X)
&lt;/h3&gt;

&lt;p&gt;When a key is pressed on OS X, the interrupt signal triggers an event in the I/O Kit keyboard driver (a kernel extension or "kext"). This driver translates the hardware signal into a key code. The key code is then passed to the &lt;strong&gt;WindowServer&lt;/strong&gt;, which manages the graphical user interface.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;WindowServer&lt;/strong&gt; dispatches the key press event to the appropriate applications (such as the active or listening ones) by sending it through their &lt;strong&gt;Mach port&lt;/strong&gt;, where it is placed into an event queue. Applications with the proper privileges can access this event queue by calling the &lt;code&gt;mach_ipc_dispatch&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;Most applications handle this process through the NSApplication main event loop, which is responsible for processing user input. When the event is a key press, it is represented as an NSEvent of type NSEventTypeKeyDown. The application then reads this event and responds accordingly, triggering any code related to keypress actions based on the key code received.&lt;/p&gt;
&lt;h3&gt;
  
  
  The Xorg Server Listens for Keycodes (On GNU/Linux)
&lt;/h3&gt;

&lt;p&gt;When a key is pressed in a graphical environment using the X server, the X server employs the &lt;strong&gt;evdev&lt;/strong&gt; (event device) driver to capture the keypress event. The keycode from the physical keyboard is then re-mapped into a &lt;strong&gt;scancode&lt;/strong&gt; using X server-specific keymaps and rules.&lt;/p&gt;

&lt;p&gt;Once the mapping is complete, the X server forwards the resulting &lt;strong&gt;scancode&lt;/strong&gt; to the &lt;strong&gt;window manager&lt;/strong&gt; (such as DWM, Metacity, i3, etc.). The window manager, in turn, sends the character or key event to the currently focused window. The &lt;strong&gt;graphical API&lt;/strong&gt; of the focused window processes this event and displays the corresponding symbol in the appropriate field, using the correct font, based on the key pressed.&lt;/p&gt;

&lt;p&gt;This flow ensures that the character is correctly rendered in the active application’s interface, completing the keypress interaction from hardware to graphical output.&lt;/p&gt;
&lt;h3&gt;
  
  
  Parse URL
&lt;/h3&gt;

&lt;p&gt;When the browser parses the URL(Uniform Resource Locator), it extracts the following components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Protocol: &lt;code&gt;"http"&lt;/code&gt;
The browser understands that this uses the Hyper Text Transfer Protocol to communicate with the server.&lt;/li&gt;
&lt;li&gt;Resource: &lt;code&gt;"/"&lt;/code&gt;
This indicates that the browser should retrieve the main (index) page of the website, as the &lt;code&gt;/&lt;/code&gt; path typically refers to the root or home page of the server.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each of these components helps the browser interpret and fetch the desired resource from the web.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F78ybjwioh3fcmnzztt7m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F78ybjwioh3fcmnzztt7m.png" alt="URL Parsing" width="800" height="458"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Is it a URL or a Search Term?
&lt;/h3&gt;

&lt;p&gt;When no protocol (e.g., "http") or valid domain name is provided, the browser interprets the text in the address bar as a potential search term. Instead of trying to resolve it as a URL, the browser forwards the text to its default web search engine.&lt;/p&gt;

&lt;p&gt;In most cases, the browser appends a special identifier to the search query, indicating that the request originated from the browser's URL bar. This allows the search engine to handle and prioritize these searches accordingly, improving the relevance of the results based on the context.&lt;/p&gt;

&lt;p&gt;This process helps the browser determine whether it should attempt to navigate directly to a website or provide search results based on the entered text.&lt;/p&gt;
&lt;h3&gt;
  
  
  Convert Non-ASCII Unicode Characters in the Hostname
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The browser examines the hostname for any characters that fall outside the ASCII range, specifically those that are not in the sets of a-z, A-Z, 0-9, -, or ..&lt;/li&gt;
&lt;li&gt;In this case, the hostname is google.com, which contains only ASCII characters, so no conversion is necessary. However, if there were non-ASCII characters present in the hostname, the browser would apply Punycode encoding to convert the hostname into a valid ASCII representation. This process ensures that all characters in the hostname can be correctly processed by the network protocols.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Check HSTS List
&lt;/h3&gt;

&lt;p&gt;The browser first checks its preloaded &lt;strong&gt;HSTS (HTTP Strict Transport Security)&lt;/strong&gt; list, which contains websites that have explicitly requested to be accessed only via &lt;strong&gt;HTTPS&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If the requested website is found on this list, the browser automatically sends the request using &lt;strong&gt;HTTPS&lt;/strong&gt; rather than &lt;strong&gt;HTTP&lt;/strong&gt;. If the website is not in the HSTS list, the initial request is sent via &lt;strong&gt;HTTP&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It’s important to note that a website can still implement HSTS without being included in the preloaded list. In such cases, the first &lt;strong&gt;HTTP&lt;/strong&gt; request made by the user will return a response instructing the browser to only send subsequent requests via &lt;strong&gt;HTTPS&lt;/strong&gt;. However, this initial &lt;strong&gt;HTTP&lt;/strong&gt; request could expose the user to a &lt;a href="https://venafi.com/blog/what-are-ssl-stripping-attacks/" rel="noopener noreferrer"&gt;downgrade attack&lt;/a&gt;, where an attacker might intercept the request and force it to remain unencrypted. This vulnerability is why modern web browsers include the HSTS list, enhancing security for users by preventing insecure connections from being established in the first place.&lt;/p&gt;
&lt;h3&gt;
  
  
  DNS Lookup
&lt;/h3&gt;

&lt;p&gt;The browser begins the DNS lookup process by checking if the domain is already present in its cache. (To view the DNS cache in Google Chrome, navigate to &lt;code&gt;chrome://net-internals/#dns&lt;/code&gt;.)&lt;/p&gt;

&lt;p&gt;If the domain is not found in the cache, the browser calls the &lt;code&gt;gethostbyname&lt;/code&gt; library function (the specific function may vary depending on the operating system) to perform the hostname resolution.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Local Hosts File Check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;gethostbyname&lt;/code&gt; function first checks if the hostname can be resolved by referencing the local hosts file, whose location varies by operating system. This file is a simple text file that maps hostnames to IP addresses and can provide a quick resolution without querying DNS.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;DNS Server Request:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the hostname is not cached and cannot be found in the hosts file, the browser then sends a request to the DNS server configured in the network stack. This server is typically the local router or the ISP's caching DNS server, which stores previously resolved names to speed up future requests.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;ARP Process for DNS Server:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the DNS server is on the same subnet, the network library follows the ARP (Address Resolution Protocol) process to resolve the IP address of the DNS server, ensuring that the request is directed correctly within the local network.&lt;/li&gt;
&lt;li&gt;If the DNS server is on a different subnet, the network library instead follows the ARP process for the default gateway IP, which acts as an intermediary to route the request to the appropriate subnet.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This systematic approach ensures that the browser efficiently resolves domain names to IP addresses, enabling it to establish a connection to the desired website. By checking the cache first, using the local hosts file, and finally querying the DNS server, the browser minimizes the time spent on hostname resolution.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2n1ngxq6v2d3g9tnw8bf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2n1ngxq6v2d3g9tnw8bf.png" alt="Sequence of DNS Lookup" width="800" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sequence Diagram&lt;/p&gt;
&lt;h3&gt;
  
  
  ARP Process
&lt;/h3&gt;

&lt;p&gt;In order to send an ARP (Address Resolution Protocol) broadcast, the network stack library needs two key pieces of information: the target IP address that needs to be looked up and the MAC address of the interface that will be used to send out the ARP broadcast.&lt;/p&gt;
&lt;h4&gt;
  
  
  Checking the ARP Cache:
&lt;/h4&gt;

&lt;p&gt;The ARP cache is first checked for an entry corresponding to the target IP address. If an entry exists, the library function returns the result in the format:&lt;br&gt;
&lt;strong&gt;Target IP = MAC&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;If the Entry is Not in the ARP Cache:&lt;/p&gt;

&lt;p&gt;If there is no entry for the target IP address, the following steps are taken:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The route table is consulted to determine whether the target IP address is on any of the subnets listed in the local route table.

&lt;ul&gt;
&lt;li&gt;If it is found, the library uses the interface associated with that subnet.&lt;/li&gt;
&lt;li&gt;If not, the library defaults to using the interface that connects to the default gateway.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;The MAC address of the selected network interface is then retrieved.
#### Sending the ARP Request:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The network library constructs and sends a Layer 2 (data link layer of the OSI model) ARP request with the following format: ARP Request:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Sender MAC&lt;/strong&gt;: interface:mac:address:here&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sender IP&lt;/strong&gt;: interface.ip.goes.here&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Target MAC&lt;/strong&gt;: FF:FF:FF:FF:FF:FF (Broadcast)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Target IP&lt;/strong&gt;: target.ip.goes.here &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Depending on the hardware setup between the computer and the router, the behavior of the ARP request varies:&lt;/p&gt;
&lt;h5&gt;
  
  
  Directly Connected:
&lt;/h5&gt;

&lt;p&gt;If the computer is directly connected to the router, the router will respond with an ARP Reply (see below).&lt;/p&gt;
&lt;h5&gt;
  
  
  Hub:
&lt;/h5&gt;

&lt;p&gt;If the computer is connected to a hub, the hub will broadcast the ARP request out of all its other ports. If the router is connected to the same "wire," it will respond with an ARP Reply (see below).&lt;/p&gt;
&lt;h5&gt;
  
  
  Switch:
&lt;/h5&gt;

&lt;p&gt;If the computer is connected to a switch, the switch will check its local CAM/MAC table to identify which port has the MAC address being queried. If the switch has no entry for the MAC address, it will rebroadcast the ARP request to all other ports. If the switch does have an entry in its MAC/CAM table, it will send the ARP request only to the port that has the corresponding MAC address.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the router is on the same "wire," it will respond with an ARP Reply (see below).&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  ARP Reply:
&lt;/h4&gt;

&lt;p&gt;The ARP reply will have the following format:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sender MAC&lt;/strong&gt;: target:mac:address:here&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sender IP&lt;/strong&gt;: target.ip.goes.here&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Target MAC&lt;/strong&gt;: interface:mac:address:here&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Target IP&lt;/strong&gt;: interface.ip.goes.here&lt;/p&gt;

&lt;p&gt;Now that the network library has obtained the IP address of either the DNS server or the default gateway, it can resume its DNS process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The DNS client establishes a socket connection to UDP port 53 on the DNS server, utilizing a source port above 1023.&lt;/li&gt;
&lt;li&gt;If the response size exceeds the UDP limit, TCP will be used instead to accommodate the larger response.&lt;/li&gt;
&lt;li&gt;If the local or ISP DNS server does not have the requested information, it will initiate a recursive search, querying a hierarchy of DNS servers until the SOA (Start of Authority) is reached, at which point the answer is returned.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Opening of a Socket
&lt;/h3&gt;

&lt;p&gt;Once the browser receives the IP address of the destination server, it combines this with the port number specified in the URL (where HTTP defaults to port 80 and HTTPS to port 443). The browser then makes a call to the system library function named &lt;code&gt;socket&lt;/code&gt;, requesting a TCP socket stream using &lt;code&gt;AF_INET&lt;/code&gt; or &lt;code&gt;AF_INET6&lt;/code&gt; and &lt;code&gt;SOCK_STREAM&lt;/code&gt;.&lt;/p&gt;
&lt;h4&gt;
  
  
  Transport Layer Processing:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;This request is first processed by the Transport Layer, where a TCP segment is crafted. The destination port is added to the header, and a source port is chosen from within the kernel’s dynamic port range (as specified by &lt;code&gt;ip_local_port_range&lt;/code&gt; in Linux).&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Network Layer Processing:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;This segment is then sent to the Network Layer, which wraps it in an additional IP header. The IP addresses of both the destination server and the current machine are inserted to form a packet.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Link Layer Processing:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;The packet next arrives at the Link Layer, where a frame header is added. This header includes the MAC address of the machine’s NIC (Network Interface Card) as well as the MAC address of the gateway (local router). If the kernel does not know the MAC address of the gateway, it must broadcast an ARP query to find it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At this point, the packet is ready to be transmitted through one of the following methods:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Ethernet&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;WiFi&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cellular Data Network&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For most home or small business Internet connections, the packet will pass from your computer, possibly through a local network, and then through a modem (Modulator/Demodulator). This modem converts digital 1’s and 0’s into an analog signal suitable for transmission over telephone, cable, or wireless telephony connections. On the other end of the connection, another modem converts the analog signal back into digital data for processing by the next &lt;strong&gt;network node&lt;/strong&gt;, where the from and to addresses would be analyzed further.&lt;/p&gt;

&lt;p&gt;In contrast, larger businesses and some newer residential connections will use fiber or direct Ethernet connections, allowing the data to remain digital and be passed directly to the next network node for processing.&lt;/p&gt;

&lt;p&gt;Eventually, the packet will reach the router managing the local subnet. From there, it will continue to travel to the autonomous system’s (AS) border routers, traverse other ASes, and finally arrive at the destination server. Each router along the way extracts the destination address from the IP header and routes it to the appropriate next hop. The time to live (TTL) field in the IP header is decremented by one for each router that processes it. The packet will be dropped if the TTL field reaches zero or if the current router has no space in its queue (which may occur due to network congestion).&lt;br&gt;
This send and receive process happens multiple times following the TCP connection flow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;strong&gt;client&lt;/strong&gt; chooses an Initial Sequence Number (ISN) and sends a packet to the server with the SYN bit set to indicate it is setting the ISN.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;server&lt;/strong&gt; receives the SYN and, if it is agreeable, performs the following:

&lt;ul&gt;
&lt;li&gt;Chooses its own initial sequence number.&lt;/li&gt;
&lt;li&gt;Sets the SYN bit to indicate it is choosing its ISN.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copies the (client ISN + 1) to its ACK field and adds the ACK flag to indicate it is acknowledging receipt of the first packet.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The client acknowledges the connection by sending a packet that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Increases its own sequence number.&lt;/li&gt;
&lt;li&gt;Increases the receiver acknowledgment number.&lt;/li&gt;
&lt;li&gt;Sets the ACK field.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Data Transfer&lt;/strong&gt;: Data is transferred as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;As one side sends N data bytes, it increases its sequence number (SEQ) by that number.&lt;/li&gt;
&lt;li&gt;When the other side acknowledges receipt of that packet (or a string of packets), it sends an ACK packet with the acknowledgment (ACK) value equal to the last received sequence from the other side.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Closing the Connection&lt;/strong&gt;: To close the connection:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The side initiating the closure sends a FIN packet.&lt;/li&gt;
&lt;li&gt;The other side acknowledges the FIN packet and sends its own FIN.&lt;/li&gt;
&lt;li&gt;The initiating side acknowledges the other side’s FIN with an ACK.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6jszxrn8742at79w9w1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fw6jszxrn8742at79w9w1.png" alt="Sequence Diagram of Opening of a Socket" width="800" height="632"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Opening of a Socket: Sequence Diagram&lt;/p&gt;
&lt;h3&gt;
  
  
  TLS Handshake
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The client computer sends a &lt;code&gt;ClientHello&lt;/code&gt; message to the server, which includes its Transport Layer Security (TLS) version, a list of available cipher algorithms, and compression methods.&lt;/li&gt;
&lt;li&gt;In response, the server replies with a &lt;code&gt;ServerHello&lt;/code&gt; message that specifies the TLS version, the selected cipher, the selected compression methods, and the server's public certificate signed by a Certificate Authority (CA). This certificate contains a public key that will be used by the client to encrypt the remainder of the handshake until a symmetric key can be agreed upon.&lt;/li&gt;
&lt;li&gt;The client verifies the server's digital certificate against its list of trusted CAs. If trust can be established based on the CA, the client generates a string of pseudo-random bytes and encrypts this string using the server's public key. These random bytes will be used to determine the symmetric key.&lt;/li&gt;
&lt;li&gt;The server decrypts the random bytes using its private key and utilizes these bytes to generate its own copy of the symmetric master key.&lt;/li&gt;
&lt;li&gt;The client sends a &lt;code&gt;Finished&lt;/code&gt; message to the server, encrypting a hash of the transmission that has occurred up to this point with the symmetric key.&lt;/li&gt;
&lt;li&gt;The server generates its own hash and then decrypts the hash sent by the client to verify that it matches. If the hashes match, the server sends its own &lt;code&gt;Finished&lt;/code&gt; message back to the client, which is also encrypted with the symmetric key.&lt;/li&gt;
&lt;li&gt;From this point forward, the TLS session transmits application (HTTP) data encrypted with the agreed-upon symmetric key.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This handshake process establishes a secure connection between the client and server, ensuring that data transmitted over the connection is protected from eavesdropping and tampering.&lt;/p&gt;
&lt;h3&gt;
  
  
  If a Packet is Dropped
&lt;/h3&gt;

&lt;p&gt;Sometimes, due to network congestion or flaky hardware connections, TLS packets may be dropped before reaching their final destination. In such cases, the sender must decide how to react. The algorithm governing this response is known as &lt;strong&gt;TCP congestion control&lt;/strong&gt;. The specific implementation can vary depending on the sender, with the most common algorithms being &lt;strong&gt;Cubic&lt;/strong&gt; on newer operating systems and New Reno on many others.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The client chooses a congestion window based on the &lt;strong&gt;maximum segment size&lt;/strong&gt; (MSS) of the connection.&lt;/li&gt;
&lt;li&gt;For each packet acknowledged, the congestion window doubles in size until it reaches the 'slow-start threshold.' In some implementations, this threshold is adaptive and can change based on network conditions.&lt;/li&gt;
&lt;li&gt;Once the slow-start threshold is reached, the window increases additively for each packet acknowledged. If a packet is dropped, the window reduces exponentially until another packet is acknowledged.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This congestion control mechanism helps optimize network performance and stability, ensuring that data can be transmitted efficiently while minimizing the impact of packet loss.&lt;/p&gt;
&lt;h3&gt;
  
  
  HTTP Protocol
&lt;/h3&gt;

&lt;p&gt;If the web browser used was developed by Google, instead of sending a standard HTTP request to retrieve a page, it may attempt to negotiate an "upgrade" from HTTP to the SPDY protocol with the server.&lt;/p&gt;

&lt;p&gt;If the client is using the HTTP protocol and does not support SPDY, it sends a request to the server in the following format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET / HTTP/1.1
Host: google.com
Connection: close
[other headers]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;[other headers]&lt;/code&gt; refers to a series of colon-separated key-value pairs formatted according to the HTTP specification and separated by single newlines. This assumes that the web browser is free of bugs that violate the HTTP specification and that it is using &lt;strong&gt;HTTP/1.1&lt;/strong&gt;. If it were using a different version, such as &lt;strong&gt;HTTP/1.0&lt;/strong&gt; or &lt;strong&gt;HTTP/0.9&lt;/strong&gt;, it might not include the &lt;code&gt;Host&lt;/code&gt; header in the request.&lt;/p&gt;

&lt;p&gt;HTTP/1.1 defines the "close" connection option for the sender to signal that the connection will be closed after the response is completed. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Connection: close

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;HTTP/1.1 applications that do not support persistent connections &lt;strong&gt;MUST&lt;/strong&gt; include the "close" connection option in every message.&lt;/p&gt;

&lt;p&gt;After sending the request and headers, the web browser sends a single blank newline to the server to indicate that the content of the request is complete.&lt;/p&gt;

&lt;p&gt;The server then responds with a response code that denotes the status of the request, structured as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;200 OK
[response headers]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is followed by a single newline and then the payload containing the HTML content of &lt;code&gt;www.google.com&lt;/code&gt;. The server may either close the connection or, if requested by the headers sent by the client, keep the connection open for reuse in further requests.&lt;/p&gt;

&lt;p&gt;If the HTTP headers sent by the web browser contained sufficient information for the web server to determine whether the version of the file cached by the web browser has been unmodified since the last retrieval (for example, if the web browser included an &lt;code&gt;ETag&lt;/code&gt;header), the server may instead respond with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;304 Not Modified
[response headers]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This response will have no payload, and the web browser will retrieve the HTML from its cache.&lt;/p&gt;

&lt;p&gt;After parsing the HTML, the web browser (and server) repeats this process for every resource (image, CSS, favicon.ico, etc.) referenced in the HTML page. In these cases, instead of &lt;code&gt;GET / HTTP/1.1&lt;/code&gt;, the request will be structured as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET /$(URL relative to www.google.com) HTTP/1.1

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the HTML references a resource on a different domain than &lt;code&gt;www.google.com&lt;/code&gt;, the web browser returns to the steps involved in resolving the other domain, following all steps up to this point for that domain. The &lt;code&gt;Host&lt;/code&gt; header in the request will be set to the appropriate server name instead of &lt;code&gt;google.com&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTTP Server Request Handling
&lt;/h3&gt;

&lt;p&gt;The &lt;strong&gt;HTTPD (HTTP Daemon) server&lt;/strong&gt; is responsible for handling requests and responses on the server side. The most common HTTPD servers include Apache and Nginx for Linux, as well as IIS for Windows.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Receiving the Request:&lt;/strong&gt; The HTTPD server receives the incoming request from the client.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Breaking Down the Request:&lt;/strong&gt; The server analyzes the request and extracts the following parameters:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;HTTP Request Method:&lt;/strong&gt; This could be one of several methods, including &lt;code&gt;GET&lt;/code&gt;, &lt;code&gt;HEAD&lt;/code&gt;, &lt;code&gt;POST&lt;/code&gt;, &lt;code&gt;PUT&lt;/code&gt;, &lt;code&gt;PATCH&lt;/code&gt;, &lt;code&gt;DELETE&lt;/code&gt;, &lt;code&gt;CONNECT&lt;/code&gt;, &lt;code&gt;OPTIONS&lt;/code&gt;, or &lt;code&gt;TRACE&lt;/code&gt;. In the case of a URL entered directly into the address bar, the method will typically be &lt;code&gt;GET&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Domain:&lt;/strong&gt; In this case, the domain is &lt;code&gt;google.com&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Requested Path/Page:&lt;/strong&gt; Here, the requested path is &lt;code&gt;/&lt;/code&gt;, indicating that no specific page was requested; thus, &lt;code&gt;/&lt;/code&gt; is treated as the default path.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verifying the Virtual Host:&lt;/strong&gt; The server checks whether a Virtual Host is configured for &lt;code&gt;google.com&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Method Verification:&lt;/strong&gt; The server verifies that &lt;code&gt;google.com&lt;/code&gt; can accept &lt;code&gt;GET&lt;/code&gt; requests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client Permission Check:&lt;/strong&gt; The server checks if the client is allowed to use this method based on criteria such as IP address, authentication, etc. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Request Rewriting:&lt;/strong&gt; If the server has a rewrite module installed (such as &lt;code&gt;mod_rewrite&lt;/code&gt; for Apache or URL Rewrite for IIS), it attempts to match the request against any configured rules. If a matching rule is found, the server rewrites the request according to that rule. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Content Retrieval:&lt;/strong&gt; The server retrieves the content that corresponds to the request. In this case, it will typically default to the index file since the request path is &lt;code&gt;/&lt;/code&gt;. While there are cases that can override this behavior, using the index file is the most common method.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;File Parsing and Processing:&lt;/strong&gt; The server parses the index file according to the designated handler. If Google is using PHP, for example, the server will utilize PHP to interpret the index file and stream the output back to the client.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By following these steps, the HTTPD server efficiently processes incoming requests and returns the appropriate responses to the client.&lt;/p&gt;

&lt;h3&gt;
  
  
  Browser
&lt;/h3&gt;

&lt;p&gt;The primary functionality of a browser is to present the web resources you choose by requesting them from a server and displaying them in the browser window. The resource is typically an HTML document but may also include PDFs, images, or other types of content. The location of the resource is specified by the user using a URI (Uniform Resource Identifier).&lt;/p&gt;

&lt;p&gt;The way a browser interprets and displays HTML files is defined by the HTML and CSS specifications, which are maintained by the W3C (World Wide Web Consortium), the standards organization for the web.&lt;/p&gt;

&lt;p&gt;Browser user interfaces share many common features, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An address bar for entering a URI&lt;/li&gt;
&lt;li&gt;Back and forward buttons for navigation&lt;/li&gt;
&lt;li&gt;Bookmarking options for saving favorite pages&lt;/li&gt;
&lt;li&gt;Refresh and stop buttons for refreshing or halting the loading of current documents&lt;/li&gt;
&lt;li&gt;A home button that takes you to your home page&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Browser High-Level Structure
&lt;/h4&gt;

&lt;p&gt;The components of a browser can be broken down as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;User Interface:&lt;/strong&gt; This includes the address bar, back/forward buttons, bookmarking menu, and any other part of the browser's display except for the window where the requested page is shown.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Browser Engine:&lt;/strong&gt; The browser engine acts as a bridge between the user interface and the rendering engine, managing actions and interactions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rendering Engine:&lt;/strong&gt; Responsible for displaying requested content, the rendering engine parses HTML and CSS, transforming the parsed content into a visual representation on the screen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Networking:&lt;/strong&gt; This component handles network calls, such as HTTP requests, and utilizes different implementations tailored for various platforms while providing a platform-independent interface.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UI Backend:&lt;/strong&gt; The UI backend is responsible for drawing basic widgets like combo boxes and windows. It exposes a generic interface that is not specific to any platform and relies on the operating system's user interface methods.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JavaScript Engine:&lt;/strong&gt; This engine parses and executes JavaScript code, allowing for dynamic content and interactivity within web pages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Storage:&lt;/strong&gt; This acts as a persistence layer, enabling the browser to save various types of data locally, such as cookies. Browsers also support storage mechanisms like localStorage, IndexedDB, WebSQL, and FileSystem.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Each of these components works together to create a seamless browsing experience, allowing users to access and interact with web resources efficiently.&lt;/p&gt;

&lt;h3&gt;
  
  
  HTML Parsing
&lt;/h3&gt;

&lt;p&gt;The rendering engine begins retrieving the contents of the requested document from the networking layer, typically in 8 kB chunks. The primary responsibility of the HTML parser is to transform the HTML markup into a structured representation known as a parse tree.&lt;/p&gt;

&lt;p&gt;The output tree, referred to as the "parse tree," consists of a hierarchy of DOM (Document Object Model) element and attribute nodes. The DOM serves as the object representation of the HTML document, providing an interface for HTML elements to interact with external scripts, such as JavaScript. The root of this tree is the "Document" object, and prior to any scripting manipulations, the DOM maintains an almost one-to-one correspondence with the original markup.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Parsing Algorithm
&lt;/h4&gt;

&lt;p&gt;HTML cannot be parsed effectively using traditional top-down or bottom-up parsers due to several factors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Forgiving Nature of the Language:&lt;/strong&gt; HTML is designed to be lenient with syntax errors, allowing browsers to display content even when the markup is not perfectly structured.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Browser Error Tolerance:&lt;/strong&gt; Browsers are built to handle common cases of invalid HTML, ensuring that users have a functional experience.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reentrancy of the Parsing Process:&lt;/strong&gt; In other programming languages, the source remains unchanged during parsing. However, in HTML, dynamic elements (like &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tags containing &lt;code&gt;document.write()&lt;/code&gt; calls) can modify the input during parsing, which necessitates a different approach.
Because of these challenges, browsers employ a custom parser tailored for HTML. The parsing algorithm is thoroughly described in the HTML5 specification and consists of two primary stages: tokenization and tree construction.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Actions When Parsing is Finished
&lt;/h4&gt;

&lt;p&gt;Once the parsing is complete, the browser proceeds to fetch external resources linked to the page, such as CSS stylesheets, images, and JavaScript files. At this point, the browser marks the document as interactive and begins parsing scripts that are in "deferred" mode, meaning those scripts are intended to execute after the document has been fully parsed. The document state is then set to "complete," and a "load" event is triggered.&lt;/p&gt;

&lt;p&gt;Importantly, browsers do not generate an "Invalid Syntax" error for HTML pages. Instead, they automatically correct any invalid content and continue processing the document, ensuring that users can view web pages with minimal disruption.&lt;/p&gt;

&lt;h2&gt;
  
  
  CSS Interpretation
&lt;/h2&gt;

&lt;p&gt;The process of CSS interpretation involves several key steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;**Parsing CSS Files: **The browser parses external CSS files, the contents within &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; tags, and the values within &lt;code&gt;style&lt;/code&gt; attributes. This parsing follows the "CSS lexical and syntax grammar," which defines the rules and structure of valid CSS.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Creating StyleSheet Objects:&lt;/strong&gt; Each parsed CSS file is transformed into a &lt;code&gt;StyleSheet&lt;/code&gt; object. Each &lt;code&gt;StyleSheet&lt;/code&gt; object encapsulates the CSS rules, including selectors and the corresponding CSS declarations. This structured representation allows for efficient access and manipulation of styles.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Parsing Techniques:&lt;/strong&gt; The CSS parser can utilize either top-down or bottom-up parsing techniques, depending on the specific parser generator employed. These techniques determine how the parser reads and processes the CSS rules, affecting the efficiency and accuracy of the parsing process.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fev3uwi9zq3cnsbgtq9cu.png" alt="CSS Interpretation" width="800" height="331"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Through this interpretation, the browser builds a comprehensive understanding of how to apply styles to the HTML elements in the DOM, facilitating the rendering of the web page with the intended visual presentation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Page Rendering
&lt;/h3&gt;

&lt;p&gt;The rendering process of a web page involves several structured steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Creating the Frame Tree:&lt;/strong&gt; The rendering engine constructs a 'Frame Tree' or 'Render Tree' by traversing the DOM nodes and calculating the computed CSS styles for each node. This tree represents the visual structure of the page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Calculating Preferred Width:&lt;/strong&gt; The preferred width for each node in the Frame Tree is calculated in a bottom-up manner. This involves summing the preferred widths of the child nodes along with the node's horizontal margins, borders, and padding.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Calculating Actual Width:&lt;/strong&gt; The actual width of each node is determined in a top-down approach by distributing the available width among its children based on their needs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Calculating Height:&lt;/strong&gt; The height of each node is calculated bottom-up by applying text wrapping and summing the heights of the child nodes along with the node's margins, borders, and padding.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Determining Node Coordinates:&lt;/strong&gt; The coordinates of each node are computed using the width and height information gathered in the previous steps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Handling Complex Elements:&lt;/strong&gt; More intricate calculations are performed for elements that are floated, positioned absolutely or relatively, or that employ other complex features. For further details, refer to the CSS specifications at &lt;a href="http://dev.w3.org/csswg/css2/" rel="noopener noreferrer"&gt;CSS2&lt;/a&gt; and the &lt;a href="http://www.w3.org/Style/CSS/current-work" rel="noopener noreferrer"&gt;current CSS work&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Creating Layers:&lt;/strong&gt; Layers are created to describe which parts of the page can be animated together without requiring re-rasterization. Each frame/render object is assigned to a specific layer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Allocating Textures:&lt;/strong&gt; Textures are allocated for each layer of the page to optimize rendering performance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Executing Drawing Commands:&lt;/strong&gt; The frame/render objects for each layer are traversed, and drawing commands are executed for their respective layers. This rendering can be handled by the CPU or directly drawn on the GPU using technologies like D2D (Direct2D) or SkiaGL.&lt;/li&gt;
&lt;li&gt;*&lt;em&gt;Reusing Calculated Values: *&lt;/em&gt; The rendering process can leverage calculated values from the previous rendering of the webpage, enabling more efficient incremental changes that require less computational work.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compositing Layers:&lt;/strong&gt; The final page layers are sent to the compositing process, where they are combined with other visible content, such as the browser chrome, iframes, and addon panels.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Finalizing Render Commands:&lt;/strong&gt; The final layer positions are computed, and composite commands are issued via graphics APIs like Direct3D or OpenGL. The GPU command buffers are flushed to the GPU for asynchronous rendering, and the completed frame is sent to the window server for display.
&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqiuzkx1dgop3uhf0xrov.png" alt="How to render a webpage?" width="800" height="215"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  GPU Rendering
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;During the rendering process, graphical computing tasks can utilize either the general-purpose CPU or the specialized graphical processor GPU.&lt;/li&gt;
&lt;li&gt;When leveraging the GPU for graphical rendering computations, the graphical software layers divide the workload into multiple smaller tasks. This approach allows them to take full advantage of the GPU's massive parallelism, which is particularly effective for the floating-point calculations required in the rendering process.&lt;/li&gt;
&lt;li&gt;The GPU excels in handling numerous operations simultaneously, making it well-suited for rendering complex visual content efficiently and rapidly. This parallel processing capability significantly enhances performance, especially in applications involving high-resolution graphics, animations, and real-time rendering.&lt;/li&gt;
&lt;li&gt;As a result, using the GPU not only speeds up the rendering process but also enables more sophisticated visual effects and smoother user experiences in modern web applications and graphics-intensive software.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxin9xylsdriy0dp86jyi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxin9xylsdriy0dp86jyi.png" alt="Benefits of GPU Rendering" width="800" height="683"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This image is also rendered by the GPU&lt;/p&gt;

&lt;h3&gt;
  
  
  Post-Rendering and User-Induced Execution
&lt;/h3&gt;

&lt;p&gt;After the rendering process is complete, the browser executes JavaScript code triggered by various events, such as timing mechanisms (like a Google Doodle animation) or user interactions (e.g., typing a query into the search box and receiving suggestions).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Plugins:&lt;/strong&gt; Additionally, plugins such as Flash or Java may also execute, although they typically do not run at this point on the Google homepage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network Requests:&lt;/strong&gt; JavaScript scripts can initiate further network requests, fetching additional resources or data as needed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DOM Modifications:&lt;/strong&gt; These scripts have the ability to modify the existing page or its layout, which can lead to another round of page rendering and painting. This dynamic capability allows for interactive experiences, where content can change in real-time based on user actions or other conditions, enhancing the overall functionality and responsiveness of the web application.
The interaction between JavaScript execution and the rendering engine is crucial for creating rich, engaging web experiences, allowing developers to build applications that respond intuitively to user input and changing contexts.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Something Big Coming Soon</title>
      <dc:creator>Kavya Sahai</dc:creator>
      <pubDate>Sat, 28 Sep 2024 14:33:07 +0000</pubDate>
      <link>https://forem.com/kavya-sahai-god/something-big-coming-soon-2nde</link>
      <guid>https://forem.com/kavya-sahai-god/something-big-coming-soon-2nde</guid>
      <description>&lt;p&gt;I have decided to build a Full Stack web developer course from the beginning starting from HID all the way Servers and Scalability. All one needs to know, would be covered for &lt;strong&gt;FREE&lt;/strong&gt;!&lt;br&gt;
Here's what would be covered:&lt;/p&gt;

&lt;h2&gt;
  
  
  Internet
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;How does the internet work?&lt;/li&gt;
&lt;li&gt;What is HTTP?&lt;/li&gt;
&lt;li&gt;Browsers and how they work?&lt;/li&gt;
&lt;li&gt;DNS and how it works?&lt;/li&gt;
&lt;li&gt;What is Domain Name?&lt;/li&gt;
&lt;li&gt;What is hosting?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Front-end
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;HTML&lt;/li&gt;
&lt;li&gt;CSS&lt;/li&gt;
&lt;li&gt;JavaScript&lt;/li&gt;
&lt;li&gt;React.js&lt;/li&gt;
&lt;li&gt;Next.js&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  OS and General Knowledge
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Terminal usage&lt;/li&gt;
&lt;li&gt;How OSs work in general&lt;/li&gt;
&lt;li&gt;Process Mgt.&lt;/li&gt;
&lt;li&gt;Threads &amp;amp; concurrency&lt;/li&gt;
&lt;li&gt;Basic terminal commands&lt;/li&gt;
&lt;li&gt;Memory mgt.&lt;/li&gt;
&lt;li&gt;Interprocess comm.&lt;/li&gt;
&lt;li&gt;I/O mgt.&lt;/li&gt;
&lt;li&gt;POSIX basics&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Language for Backend
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Java&lt;/li&gt;
&lt;li&gt;Python&lt;/li&gt;
&lt;li&gt;PHP&lt;/li&gt;
&lt;li&gt;C#&lt;/li&gt;
&lt;li&gt;Javascript&lt;/li&gt;
&lt;li&gt;Ruby&lt;/li&gt;
&lt;li&gt;Rust&lt;/li&gt;
&lt;li&gt;Go&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Version Control System
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Basic usage of Git&lt;/li&gt;
&lt;li&gt;Repo hosting services&lt;/li&gt;
&lt;li&gt;- GitHub&lt;/li&gt;
&lt;li&gt;- Gitlab&lt;/li&gt;
&lt;li&gt;- Bitbucket&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Relational Databases
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;MySQL&lt;/li&gt;
&lt;li&gt;PostgreSQL&lt;/li&gt;
&lt;li&gt;MariaDB&lt;/li&gt;
&lt;li&gt;MS SQL&lt;/li&gt;
&lt;li&gt;Oracle&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  APIs
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;REST&lt;/li&gt;
&lt;li&gt;JSON APIs&lt;/li&gt;
&lt;li&gt;HATOAS&lt;/li&gt;
&lt;li&gt;Open API Spec and Swagger&lt;/li&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;GraphQL&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Caching
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;CDN&lt;/li&gt;
&lt;li&gt;Server-side I. Redis II. Memcached&lt;/li&gt;
&lt;li&gt;Client-side&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Security
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;HTTPS + TLS&lt;/li&gt;
&lt;li&gt;CORS&lt;/li&gt;
&lt;li&gt;MD5&lt;/li&gt;
&lt;li&gt;SHA-2&lt;/li&gt;
&lt;li&gt;SCrypt&lt;/li&gt;
&lt;li&gt;BCrypt&lt;/li&gt;
&lt;li&gt;OWASP&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  CI/CD
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Testing your code&lt;/li&gt;
&lt;li&gt;Jenkins&lt;/li&gt;
&lt;li&gt;TravisCI&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Development Concepts
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;SOLID&lt;/li&gt;
&lt;li&gt;KISS&lt;/li&gt;
&lt;li&gt;YAGNI&lt;/li&gt;
&lt;li&gt;DRY&lt;/li&gt;
&lt;li&gt;Domain-Driven Design&lt;/li&gt;
&lt;li&gt;Test Driven Development&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Software Architecture
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Microservices and Service Oriented Architecture&lt;/li&gt;
&lt;li&gt;CQRS&lt;/li&gt;
&lt;li&gt;Serverless&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Containers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Docker Fundamentals&lt;/li&gt;
&lt;li&gt;Docker Cookbook&lt;/li&gt;
&lt;li&gt;Kubernetes Cookbook&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Servers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Nginx Handbook&lt;/li&gt;
&lt;li&gt;Apache&lt;/li&gt;
&lt;li&gt;Caddy&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Scalability
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Distributed Systems&lt;/li&gt;
&lt;li&gt;System Design Primer&lt;/li&gt;
&lt;li&gt;Real-World Maintainable Software&lt;/li&gt;
&lt;li&gt;The 12 Factor App&lt;/li&gt;
&lt;li&gt;Architecting Frontend Projects To Scale&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I may shift the course structure or add other things, but the basic structure will be maintained.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>A Poetic Challenge !?</title>
      <dc:creator>Kavya Sahai</dc:creator>
      <pubDate>Tue, 17 Sep 2024 18:48:10 +0000</pubDate>
      <link>https://forem.com/kavya-sahai-god/a-poetic-challenge--24m1</link>
      <guid>https://forem.com/kavya-sahai-god/a-poetic-challenge--24m1</guid>
      <description>&lt;p&gt;September 6, 2024: Before moving onto any discussion of the problem itself, lets see the backstory. A challenge, an open mathematics challenge in a book.&lt;br&gt;
An old book from 1984 in the Library, the name of which I forgot but I got a picture of a very intriguing problem it has in the "More to Read..." section. &lt;br&gt;
A, uh, Poetic Riddle... Yes, You heard it right, a problem of Mathematics which is written in form of an Old English Poem. &lt;br&gt;
Since, High School I haven't been the fan of Poems at all, but, this one caught my attention. When I was reading it, I felt like I understood something but I didn't it fully. Spending more than six hours to understand a puzzle from a fable, of dragons and what not. But, one thing stuck me, the gems. For you to fully understand here is the poem:&lt;/p&gt;

&lt;p&gt;**In Zopraria’s endless, wondrous lands, where stars serenely hum,&lt;br&gt;&lt;br&gt;
And ancient dragons guard the skies, where time and tides are one,&lt;br&gt;&lt;br&gt;
A wise old sage lived quietly, whose knowledge spanned all time,&lt;br&gt;&lt;br&gt;
Whose hands could weave through magic’s threads as poets craft in rhyme.  &lt;/p&gt;

&lt;p&gt;One day, from heaven’s lofty heights, on wings of fire and gold,&lt;br&gt;&lt;br&gt;
A gift descended to the sage, as myths and legends told:&lt;br&gt;&lt;br&gt;
A treasure vast—of radiant gems, like fragments of the stars,&lt;br&gt;&lt;br&gt;
Yet tied to fate’s own prophecy, with rules as old as Mars.  &lt;/p&gt;

&lt;p&gt;The heavens whispered down to him, a message soft, but clear:&lt;br&gt;&lt;br&gt;
"Divide these glowing gems in two, with careful heart and ear.&lt;br&gt;&lt;br&gt;
Let both your crafted vessels hold a weight so nearly shared,&lt;br&gt;&lt;br&gt;
That harmony between them stands, in balance bright and fair.  &lt;/p&gt;

&lt;p&gt;But hear us, sage, if flawless match is lost beyond your ken,&lt;br&gt;&lt;br&gt;
Despair not in your quest, for still your journey shall not end.&lt;br&gt;&lt;br&gt;
For even if the balance tips, yet slight the shift may be,&lt;br&gt;&lt;br&gt;
The heavens still shall smile on thee, and blessings will run free."  &lt;/p&gt;

&lt;p&gt;The sage, with heart both brave and wise, began his sacred test,&lt;br&gt;&lt;br&gt;
To fashion vessels near the same, and give the stars his best.&lt;br&gt;&lt;br&gt;
The dragons circled high above, while angels paused in flight,&lt;br&gt;&lt;br&gt;
For in this task of balance lay a truth as pure as light.  &lt;/p&gt;

&lt;p&gt;The gems, like secrets from the past, before the sage did turn,&lt;br&gt;&lt;br&gt;
With every choice, the fates took shape, and hearts began to burn.&lt;br&gt;&lt;br&gt;
Though daunting was the work ahead, the stars did still admire&lt;br&gt;&lt;br&gt;
The sage who sought, with steady hand, to balance cosmic fire.  &lt;/p&gt;

&lt;p&gt;And how the story reached its end, beneath those endless skies,&lt;br&gt;&lt;br&gt;
Is only known to those who seek, and dare to lift their eyes.  &lt;/p&gt;

&lt;p&gt;In Zopraria’s boundless realms, where tales of old endure,&lt;br&gt;&lt;br&gt;
Some say the sage still ponders on, his heart and mind as pure.&lt;br&gt;&lt;br&gt;
For in the silent heavens lies a balance fine and rare,&lt;br&gt;&lt;br&gt;
A harmony that only those with steady hands may share.**&lt;/p&gt;

&lt;p&gt;This is the poem, seems weird right. And what is it doing in a Mathematics Book. This isn't a new Puzzle, a Puzzle from the old 1600s, written somewhere in modern-day Westminster.&lt;br&gt;
Nonetheless, AI is our Good friend, right, I asked it what it replied was weird, and looks like even it doesn't understand a shit.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5mclud0h8d9f8c55woon.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5mclud0h8d9f8c55woon.png" alt="AI-replying-on-this-poem" width="800" height="401"&gt;&lt;/a&gt;&lt;br&gt;
It thought I created it, which I didn't. But, what about GPT-4? Let's ask if it knows a shit. It became my english teacher. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5i3sjwfoyrm0np2ykwlj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5i3sjwfoyrm0np2ykwlj.png" alt="TF" width="481" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foxqg5klyazod47yv3m05.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foxqg5klyazod47yv3m05.png" alt="It doesn't know a shit." width="486" height="535"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ok, Need to decode it myself. Let's try.&lt;/p&gt;

&lt;p&gt;September 9, 2024: "Divide these glowing gems in two, with careful heart and ear.&lt;br&gt;&lt;br&gt;
Let both your crafted vessels hold a weight so nearly shared,&lt;br&gt;&lt;br&gt;
That harmony between them stands, in balance bright and fair.  &lt;/p&gt;

&lt;p&gt;But hear us, sage, if flawless match is lost beyond your ken,&lt;br&gt;&lt;br&gt;
Despair not in your quest, for still your journey shall not end.&lt;br&gt;&lt;br&gt;
For even if the balance tips, yet slight the shift may be,&lt;br&gt;&lt;br&gt;
The heavens still shall smile on thee, and blessings will run free."&lt;/p&gt;

&lt;p&gt;This is the main part of the story and let's decode it. &lt;br&gt;
After some brainstorming, sorry, torturing myself for more than 3 days straight, I got a clue.&lt;br&gt;
Gems may be numbers, as it said "with careful heart and ear." &lt;br&gt;
Vessels may be sets, but the concept of sets wasn't discovered till then, so, I may be wrong.&lt;br&gt;
The above extract might mean two sets of equal number of elements, or the sum of the numbers in the set is equal. And if the sum are not same, the nearest may be displayed.&lt;/p&gt;

&lt;p&gt;September 15, 2024: After some more complex thinking and publishing many supplementary Articles. I think so, I may have found the best thinking of mine on this poem. &lt;br&gt;
Though this poem is so old, I couldn't find any other solution to this poem. But, I have framed the questions such that Everybody could understand, including me.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Challenge
&lt;/h2&gt;

&lt;p&gt;From the perspective of C.S., yeah, I would do this in the form of C.S. first and then Mathematics later.&lt;/p&gt;

&lt;p&gt;We are given a list of integers. Our task is to split the list into two sub-lists such that the absolute difference of their sums is minimized. If a perfect split exists, we need to return the two lists. Otherwise, return the two lists where the sum difference is the smallest possible.&lt;/p&gt;
&lt;h3&gt;
  
  
  Example:
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Input: [3, 1, 4, 2, 2]
Output: ([2, 4], [3, 1, 2])

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;In this example, splitting the list into [2, 4] and [1, 3, 2] gives sums of 6 and 6, and the absolute difference is minimized to 0.&lt;/p&gt;
&lt;h2&gt;
  
  
  Coding
&lt;/h2&gt;

&lt;p&gt;So let's start coding.&lt;br&gt;
September 16, 2024:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from itertools import combinations

def minimize_difference(lst):
    total_sum = sum(lst)
    n = len(lst)

    # Generate all possible subsets
    best_diff = float('inf')
    best_split = ([], [])

    for i in range(1, n//2 + 1):
        for subset in combinations(lst, i):
            subset_sum = sum(subset)
            other_sum = total_sum - subset_sum

            diff = abs(subset_sum - other_sum)

            if diff &amp;lt; best_diff:
                best_diff = diff
                best_split = (list(subset), [x for x in lst if x not in subset])

    return best_split

# Example usage
lst = [3, 1, 4, 2, 2]
result = minimize_difference(lst)
print("Split lists:", result)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The fact that the code works better than my brain is just astonishing.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Code Explanation&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The problem of splitting a list into two sub-lists such that the absolute difference between their sums is minimized, stems from a fascinating mathematical challenge. Let’s break down how the provided Python code tackles this problem.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Understanding the Problem:&lt;/strong&gt;&lt;br&gt;
The goal is to find two sub-lists from the given list such that their sum is as close as possible. If a perfect split exists (where the sums of both sub-lists are equal), we return the two sub-lists. Otherwise, we return the split where the difference between the two sums is the smallest.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Code Structure:&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The core of the code lies in generating all possible combinations of elements from the list to form one of the sub-lists. Once a sub-list is selected, the other sub-list is automatically formed by the remaining elements. Then, we compare their sums to find the best possible split with the minimal difference.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Key Functions and Concepts:&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;combinations(lst, i)&lt;/code&gt;&lt;/strong&gt;: This generates all possible combinations of length &lt;code&gt;i&lt;/code&gt; from the list. For each subset, it simulates one of the sub-lists, while the remaining elements form the other sub-list.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;total_sum = sum(lst)&lt;/code&gt;&lt;/strong&gt;: This calculates the total sum of the list. It is used to easily determine the sum of the other sub-list by subtracting the sum of the current subset from the total sum.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;code&gt;best_diff = float('inf')&lt;/code&gt;&lt;/strong&gt;: We initialize the variable &lt;code&gt;best_diff&lt;/code&gt; with a large number (infinity) to keep track of the smallest difference found so far. As we go through each possible split, we update this value if we find a smaller difference.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Finding the best split&lt;/strong&gt;: For each subset generated, the code calculates the difference between the sums of the two sub-lists. If the current difference is smaller than the &lt;code&gt;best_diff&lt;/code&gt;, the split is updated.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Performance Considerations:&lt;/strong&gt;&lt;br&gt;
The code uses the &lt;code&gt;combinations&lt;/code&gt; function from the &lt;code&gt;itertools&lt;/code&gt; library to explore subsets of different lengths. While this approach works well for relatively small lists, it may not be optimal for larger lists due to the exponential growth of possible subsets. For larger inputs, more efficient algorithms like dynamic programming could be considered.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Example Output:&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In the example provided:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;   &lt;span class="n"&gt;lst&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
   &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;minimize_difference&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;lst&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
   &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Split lists:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The function splits the list into &lt;code&gt;[2, 4]&lt;/code&gt; and &lt;code&gt;[3, 1, 2]&lt;/code&gt;, resulting in sums of &lt;code&gt;6&lt;/code&gt; and &lt;code&gt;6&lt;/code&gt; respectively, and a minimal difference of &lt;code&gt;0&lt;/code&gt;, which is the optimal solution in this case.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Why it works well:&lt;/strong&gt;
By exploring all possible subsets and calculating their respective differences, the algorithm ensures that we find the split with the smallest possible sum difference. This brute-force approach is intuitive and effective for moderate-sized lists, providing a clear and simple solution to this ancient riddle.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;The above you saw is an extract from my diary, 100% true. But a more 'storified' version is available over her &lt;a href="https://insightshub.in/a-poetic-challenge/" rel="noopener noreferrer"&gt;Storified Version of the same&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Laravel Auth Routes Tutorial</title>
      <dc:creator>Kavya Sahai</dc:creator>
      <pubDate>Sun, 15 Sep 2024 07:47:35 +0000</pubDate>
      <link>https://forem.com/kavya-sahai-god/laravel-auth-routes-tutorial-488c</link>
      <guid>https://forem.com/kavya-sahai-god/laravel-auth-routes-tutorial-488c</guid>
      <description>&lt;p&gt;Laravel auth routes is one of the essential features of the Laravel framework. Using middlewares you can implement different authentication strategies and attach them to different parts of your backend.&lt;/p&gt;

&lt;p&gt;Laravel offers a complete and flexible authentication system, capable of adapting to various needs and implementations. There are also several external packages to implement additional authentication processes other than what ship with the framework by default.&lt;/p&gt;

&lt;p&gt;In this article I show you the implications of the standard authentication system and other auth routes systems I navigated in the last ten years of experience with Laravel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Authentication Guards e Providers in Laravel
&lt;/h2&gt;

&lt;p&gt;The logic behind routes authentication in Laravel is based on the implementation of two different objects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Guard: defines how to determine whether an HTTP request is coming from an authenticated user;&lt;/li&gt;
&lt;li&gt;Provider: defines how to retrieve registered users for the application. You can check out these configurations in the config/auth.php configuration file.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/*
|--------------------------------------------------------------------------
| Authentication Guards
|--------------------------------------------------------------------------
|
*/
'guards' =&amp;gt; [
    'web' =&amp;gt; [
        'driver' =&amp;gt; 'session',
        'provider' =&amp;gt; 'users',
    ],

    'api' =&amp;gt; [
        'driver' =&amp;gt; 'passport',
        'provider' =&amp;gt; 'users',
    ],
],
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/*
|----------------------------------------------------------------------
| User Providers
|----------------------------------------------------------------------
|
*/

'providers' =&amp;gt; [
    'users' =&amp;gt; [
        'driver' =&amp;gt; 'eloquent',
        'model' =&amp;gt; \App\Domains\Organization\Models\User::class,
    ],
],

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A newly created Laravel application provides a default guard and provider configuration suited to the needs of an application that only delivers web pages and generates the HTML of its pages entirely on the server side.&lt;/p&gt;

&lt;p&gt;The default guard is “session” – which uses session cookies to establish whether the request comes from an authenticated user – and the default provider is the “database” that retrieves the registered users information via Eloquent.&lt;/p&gt;

&lt;p&gt;If you are not using a traditional relational database to store your users, you can extend Laravel with your own authentication user provider. Here is an example from the official documentation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php

namespace App\Providers;

use App\Extensions\MongoUserProvider;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    // ...

    /**
     * Bootstrap any application services.
     */
    public function boot(): void
    {
        Auth::provider('mongo', function (Application $app, array $config) {
            // Return an instance of Illuminate\Contracts\Auth\UserProvider...

            return new MongoUserProvider($app-&amp;gt;make('mongo.connection'));
        });
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Than you can change the default provider in the configuration file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'providers' =&amp;gt; [
    'users' =&amp;gt; [
        'driver' =&amp;gt; 'mongo',
    ],
],
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, you must reference this new provider in the guards configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'guards' =&amp;gt; [
    'web' =&amp;gt; [
        'driver' =&amp;gt; 'session',
        'provider' =&amp;gt; 'users',
    ],
],
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are many situations where the default configuration is not enough. For example, the case in which your application offers RESTful APIs or if it’s the backend of a Single Page Application. In this case, you need to include and configure other authentication services offered by the Laravel ecosystem.&lt;/p&gt;

&lt;p&gt;For example, in the case of the API server, you should opt for a token-type guard, which allows you to recognize clients authenticated by a specific token present in the request. Personally I use a Laravel first-party package called &lt;a href="https://laravel.com/docs/master/passport" rel="noopener noreferrer"&gt;Passport &lt;/a&gt;that implements a complete OAuth server so I can manage authentication for frontend and backend API with the same framework and a very granular logic.&lt;/p&gt;

&lt;h2&gt;
  
  
  User eloquent model as authentication provider
&lt;/h2&gt;

&lt;p&gt;It's not a coincidence that the &lt;code&gt;App\Models\User&lt;/code&gt; class does not directly extend the basic Eloquent Model class, but the &lt;code&gt;Illuminate\Foundation\Auth\User&lt;/code&gt; class. This allows us to identify it as an appropriate model to be a provider for the users of the application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    protected $fillable = [
        'name',
        'email',
        'password',
    ];

    protected $hidden = [
        'password',
        'remember_token',
    ];
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Check if a session is authenticated
&lt;/h2&gt;

&lt;p&gt;HTTP requests coming from a client that has successfully completed authentication can be spotted at various points in the stack. This allows you to intervene in appropriate ways to prevent certain actions or modify the application behaviors accordingly.&lt;/p&gt;

&lt;p&gt;You can perform this check in controllers, views and even routes. Both individual endpoints and grouped routes.&lt;/p&gt;

&lt;p&gt;The best way to enforce mandatory authentication on endpoints is using middleware. Laravel provides two built-in middlewares:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;guest – for routes accessible from unauthenticated clients;&lt;/li&gt;
&lt;li&gt;auth – for routes accessible only by authenticated users;
These middlewares are available as "route-specific" middlewares and can therefore be applied to each route, independently of any other middleware.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Navigate to the App\Http\Kernel class or in the bootstrap/app.php file inside the withMiddleware() method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
* The application's route middleware.
*
* These middlewares may be assigned to groups or used individually.
*
* @var array
*/
protected $middlewareAliases = [
    'auth' =&amp;gt; \App\Http\Middleware\Authenticate::class,
    'guest' =&amp;gt; \App\Http\Middleware\RedirectIfAuthenticated::class,

    ...
];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can use them to control access to your routes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// The home page is accessible to everyone
Route::get('/', [WebsiteController:class, 'home']);

// Register routes are accessible only to unauthenticated users
Route::get('/register', [RegisterController::class, 'create'])
    -&amp;gt;name('register')
    -&amp;gt;middleware('guest');

Route::post('/register', [RegisterController::class, 'store'])
    -&amp;gt;middleware('guest');

// Dashboard is accessible only to authenticated users
Route::get('/dashboard', [DashboardController::class, 'home'])
    -&amp;gt;middleware('auth');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The difference between GUEST and AUTH route middlewares
&lt;/h2&gt;

&lt;p&gt;The "guest" middleware is used to restrict access to certain routes or actions to unauthenticated users only.&lt;/p&gt;

&lt;p&gt;Restrict access to unauthenticated users?&lt;/p&gt;

&lt;p&gt;Yes, in fact as you can see in the snippet above the class associated with the guest middleware is "RedirectIfAuthenticated".&lt;/p&gt;

&lt;p&gt;So guest allows you to make the routes accessible if you are a “free” user, but the moment you authenticate to the website Laravel will redirect you to the "private" section of the application. You can’t navigate "guest routes" if you are authenticated.&lt;/p&gt;

&lt;p&gt;In a nutshell, "guest" is useful for the registration page, not in an e-commerce product page :).&lt;/p&gt;

&lt;p&gt;The purpose of the auth middleware, however, is not at all ambiguous. It checks if the current Request is authenticated. Otherwise you are redirected to the public section of the application, such as the login page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Authentication In Laravel Blade Template
&lt;/h2&gt;

&lt;p&gt;At this point, you may want to change the behavior of some of your application pages to show different content depending on whether it is a visitor or an authenticated user. To do this, we can use the &lt;a class="mentioned-user" href="https://dev.to/auth"&gt;@auth&lt;/a&gt; directive:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@auth
    &amp;lt;span&amp;gt;Welcome {{ auth()-&amp;gt;user()-&amp;gt;name }}&amp;lt;/span&amp;gt;
@else
    &amp;lt;a href="{{ route('login') }}"&amp;gt;Login&amp;lt;/a&amp;gt;
    &amp;lt;a href="{{ route('register') }}"&amp;gt;Register&amp;lt;/a&amp;gt;
@endauth
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;a class="mentioned-user" href="https://dev.to/auth"&gt;@auth&lt;/a&gt; and &lt;a class="mentioned-user" href="https://dev.to/guest"&gt;@guest&lt;/a&gt; directives operate like an if statement, thus allowing portions of the view to be rendered if the rendering of the view is requested by an authenticated user or a visitor respectively.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to get the authenticated user
&lt;/h2&gt;

&lt;p&gt;Laravel provides you with a built-in service called "Auth" that allows you to operate transparently with the underlying user providers and guards.To access the Auth service you can use the Facade &lt;code&gt;Illuminate\Support\Facades\Auth&lt;/code&gt;, or the helper function auth().&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;use Illuminate\Support\Facades\Auth;

// Access the authenticated User instance
$name = Auth::user()-&amp;gt;name;
$name = auth()-&amp;gt;user()-&amp;gt;name;

// Check if the current session is authenticated
if (Auth::check()) {
    // User logged in
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Logout: Terminate an authenticated session in Laravel
&lt;/h2&gt;

&lt;p&gt;In your &lt;code&gt;routes/web.php&lt;/code&gt; you should have the logout route:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Route::get('logout', [LoginController::class, 'logout')-&amp;gt;middleware('auth');

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the LoginController.php&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public function logout(Request $request) 
{
    Auth::logout();
    return redirect('/login');
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, you are able to logout using &lt;code&gt;yourdomain.com/logout&lt;/code&gt; URL or if you have created a logout button, add href to "/logout".&lt;/p&gt;

&lt;p&gt;The logout method will clear the authentication information in the user’s session.&lt;/p&gt;

&lt;h2&gt;
  
  
  Logout other devices
&lt;/h2&gt;

&lt;p&gt;Invalidating sessions on other devices Laravel also provides a mechanism for invalidating and "logging out" user sessions that are active on other devices without invalidating the session on their current device. This feature is typically used when a user changes or updates their password and you want to invalidate sessions on other devices while maintaining the authenticity of the current device.&lt;/p&gt;

&lt;p&gt;To implement this feature Laravel provides a built-in middleware that you should add to the “web” middleware group: &lt;code&gt;\Illuminate\Session\Middleware\AuthenticateSession&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'web' =&amp;gt; [
    // ...
    \Illuminate\Session\Middleware\AuthenticateSession::class,
    // ...
],
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the middleware is attached you can use the logoutOtherDevices() method on the Auth service.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;use Illuminate\Support\Facades\Auth;

public function logoutOtherDevices(Request $request)
{
    $password = $request-&amp;gt;input('password');

    if (Hash::check($password, Auth::user()-&amp;gt;password)) {
        Auth::logoutOtherDevices($password);

        // Optionally, you can regenerate the user's session ID
        $request-&amp;gt;session()-&amp;gt;regenerate();

        return redirect()-&amp;gt;back()-&amp;gt;with('success', 'Logged out from other devices successfully.');
    }

    return redirect()-&amp;gt;back()-&amp;gt;withErrors(['password' =&amp;gt; 'Invalid password.']);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the &lt;code&gt;logoutOtherDevices&lt;/code&gt; method is executed, the user remains logged in on the current device, but all other sessions associated with that user are terminated. When the user tries to access the application from other devices, they will be required to log in again. After logging out from other devices, you can optionally regenerate the user's session ID using &lt;code&gt;$request-&amp;gt;session()-&amp;gt;regenerate()&lt;/code&gt; to further enhance security.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvte1o2885w42vhn09jk3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvte1o2885w42vhn09jk3.png" alt="Laravel application monitoring" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Originally Published at &lt;a href="https://insightshub.in/laravel-auth-routes-tutorial/" rel="noopener noreferrer"&gt;Laravel Auth Routes Tutorial - InsightsHub.In&lt;/a&gt;
&lt;/h2&gt;

</description>
      <category>laravel</category>
      <category>php</category>
    </item>
    <item>
      <title>How to create a Human-Level Natural Language Understanding (NLU) System</title>
      <dc:creator>Kavya Sahai</dc:creator>
      <pubDate>Sat, 14 Sep 2024 11:57:27 +0000</pubDate>
      <link>https://forem.com/kavya-sahai-god/how-to-create-a-human-level-natural-language-understanding-nlu-system-3gmp</link>
      <guid>https://forem.com/kavya-sahai-god/how-to-create-a-human-level-natural-language-understanding-nlu-system-3gmp</guid>
      <description>&lt;p&gt;&lt;strong&gt;Scope&lt;/strong&gt;: Creating an NLU system that fully understands and processes human languages in a wide range of contexts, from conversations to literature.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Natural language is highly ambiguous, so creating models that resolve meaning in context is complex.&lt;/li&gt;
&lt;li&gt;Developing models for multiple languages and dialects.&lt;/li&gt;
&lt;li&gt;Ensuring systems understand cultural nuances, idiomatic expressions, and emotions.&lt;/li&gt;
&lt;li&gt;Training on massive datasets and ensuring high accuracy.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To create a Natural Language Understanding (NLU) system that fully comprehends and processes human languages across contexts, the design process needs to tackle both the theoretical and practical challenges of language, context, and computing. Here's a thinking process that can guide the development of such a system:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Understanding the Problem: Scope and Requirements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Define Objectives: Break down what "understanding" means in various contexts. Does the system need to understand conversation, literature, legal text, etc.?&lt;/li&gt;
&lt;li&gt;Identify Use Cases: Specify where the NLU will be applied (e.g., conversational agents, content analysis, or text-based decision-making).&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Establish Constraints: Determine what resources are available, what level of accuracy is required, and what trade-offs will be acceptable (speed vs. accuracy, for instance).&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Data Collection: Building the Knowledge Base
&lt;/h2&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Multilingual and Multidomain Corpora: Collect vast amounts of text from multiple languages and various domains like literature, technical writing, legal documents, informal text (e.g., tweets), and conversational transcripts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Contextual Data: Language is understood in context. Collect meta-data such as the speaker's background, time period, cultural markers, sentiment, and tone.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Annotations: Manually annotate datasets with syntactic, semantic, and pragmatic information to train the system on ambiguity, idioms, and context.&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Developing a Theoretical Framework
&lt;/h2&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Contextual Language Models: Leverage transformer models like GPT, BERT, or even specialized models like mBERT (multilingual BERT) for handling context-specific word embeddings. Incorporate memory networks or long-term dependencies so the system can remember previous conversations or earlier parts of a text.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Language and Culture Modeling: Transfer Learning: Use transfer learning to apply models trained on one language or context to another. For instance, a model trained on English literature can help understand the structure of French literature with proper fine-tuning.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cross-Language Embeddings: Utilize models that map words and phrases into a shared semantic space, enabling the system to handle multiple languages at once.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cultural and Emotional Sensitivity: Create sub-models or specialized attention layers to detect cultural references, emotions, and sentiment from specific regions or contexts.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Addressing Ambiguity and Pragmatic Understanding
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Disambiguation Mechanisms: Supervised Learning: Train the model on ambiguous sentences (e.g., "bank" meaning a financial institution vs. a riverbank) and provide annotated resolutions.&lt;/li&gt;
&lt;li&gt;Contextual Resolution: Use attention mechanisms to give more weight to recent conversational or textual context when interpreting ambiguous words.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Pragmatics and Speech Acts: Build a framework for pragmatic understanding (i.e., not just what is said but what is meant). Speech acts, like promises, requests, or questions, can be modeled using reinforcement learning to better understand intentions.&lt;/p&gt;
&lt;h2&gt;
  
  
  5. Dealing with Idioms and Complex Expressions
&lt;/h2&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Idiom Recognition: Collect idiomatic expressions from multiple languages and cultures. Train the model to recognize idioms not as compositional phrases but as whole entities with specific meanings. Apply pattern-matching techniques to identify idiomatic usage in real-time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Metaphor and Humor Detection: Create sub-networks trained on metaphors and humor. Use unsupervised learning to detect non-literal language and assign alternative interpretations.&lt;/p&gt;
&lt;h2&gt;
  
  
  6. Handling Large Datasets and Model Training
&lt;/h2&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Augmentation: Leverage techniques like back-translation (translating data to another language and back) or paraphrasing to increase the size and diversity of datasets.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Multi-task Learning: Train the model on related tasks (like sentiment analysis, named entity recognition, and question answering) to help the system generalize better across various contexts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Efficiency and Scalability: Use distributed computing and specialized hardware (GPUs, TPUs) for large-scale training. Leverage pruning, quantization, and model distillation to reduce model size while maintaining performance.&lt;/p&gt;
&lt;h2&gt;
  
  
  7. Incorporating External Knowledge
&lt;/h2&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Knowledge Graphs: Integrate external knowledge bases like Wikipedia, WordNet, or custom databases to provide the model with real-world context.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Commonsense Reasoning: Use models like COMET (Commonsense Transformers) to integrate reasoning about cause-and-effect, everyday events, and general knowledge.&lt;/p&gt;
&lt;h2&gt;
  
  
  8. Real-World Contextual Adaptation
&lt;/h2&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Fine-Tuning and Continuous Learning: Implement techniques for continuous learning so that the model can evolve with time and adapt to new languages, cultural changes, and evolving linguistic expressions. Fine-tune models on user-specific or region-specific data to make the system more culturally aware and contextually relevant.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Zero-Shot and Few-Shot Learning: Develop zero-shot learning capabilities, allowing the system to make educated guesses on tasks or languages it hasn’t been explicitly trained on. Few-shot learning can be used to rapidly adapt to new dialects, idioms, or cultural nuances with minimal new training data.&lt;/p&gt;
&lt;h2&gt;
  
  
  9. Evaluation and Iteration
&lt;/h2&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cross-Language Accuracy Metrics: Create benchmarks that test the system's ability to handle multiple languages and dialects, including edge cases (idioms, rare phrases, obscure language use).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Error Analysis: Systematically track and analyze errors related to ambiguity, sentiment misclassification, idiomatic misinterpretation, and context loss. Constantly refine models to improve understanding.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Human-in-the-Loop Systems: Include mechanisms for humans to intervene when the system encounters difficult-to-interpret text or when it fails. This feedback will guide iterative improvements.&lt;/p&gt;
&lt;h2&gt;
  
  
  10. Ethical Considerations and Bias Mitigation
&lt;/h2&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bias Detection: Regularly check for biases related to gender, race, and cultural issues. Biases in data can result in skewed NLU interpretations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ethical Language Usage: Ensure that the system can identify and address ethically sensitive topics, such as hate speech or misinformation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Explainability: Incorporate models that offer transparent decision-making to ensure the NLU’s reasoning can be explained and corrected if necessary.&lt;/p&gt;
&lt;h2&gt;
  
  
  11. Deployment and Continuous Maintenance
&lt;/h2&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Integration: Seamlessly integrate the NLU into various applications (chatbots, content analysis tools, sentiment analysis engines).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Monitoring: Implement monitoring tools to measure the system's performance over time and in new linguistic environments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Continuous Data Input: Set up feedback loops where the system can learn from interactions in the wild and improve its understanding through active learning.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This step-by-step process is an iterative, evolving approach that balances linguistic theory, computational power, and practical constraints. Building a system of this scale will require extensive collaboration across linguistics, machine learning, and computational infrastructure.&lt;/p&gt;

&lt;p&gt;Creating a complete Natural Language Understanding (NLU) system that works in the way described would require thousands of lines of code and a complex architecture. However, I can give you a simplified framework for building a basic NLU system in Python that incorporates some of the key elements. For this, we’ll break it down into smaller components that could be expanded upon over time.&lt;/p&gt;

&lt;p&gt;Here is a basic code structure using popular machine learning and NLP libraries such as &lt;code&gt;transformers&lt;/code&gt;, &lt;code&gt;spaCy&lt;/code&gt;, and &lt;code&gt;nltk&lt;/code&gt;. This will provide a foundation for the larger system.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Installing Dependencies&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;First, you’ll need to install some dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install &lt;/span&gt;transformers torch spacy nltk
python &lt;span class="nt"&gt;-m&lt;/span&gt; spacy download en_core_web_sm
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. &lt;strong&gt;Basic Structure of NLU System&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;We'll start with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Loading Pre-trained Models&lt;/strong&gt; for language understanding (e.g., BERT).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contextual Analysis&lt;/strong&gt; using &lt;code&gt;spaCy&lt;/code&gt; and &lt;code&gt;nltk&lt;/code&gt; for parsing sentences.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sentiment Analysis&lt;/strong&gt; as an example task.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;transformers&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;BertTokenizer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;BertForSequenceClassification&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;spacy&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;nltk&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;nltk.sentiment&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SentimentIntensityAnalyzer&lt;/span&gt;

&lt;span class="c1"&gt;# Load pre-trained models
&lt;/span&gt;&lt;span class="n"&gt;tokenizer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;BertTokenizer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_pretrained&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;bert-base-uncased&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;BertForSequenceClassification&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;from_pretrained&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;bert-base-uncased&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Load spaCy for NLP
&lt;/span&gt;&lt;span class="n"&gt;nlp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;spacy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;en_core_web_sm&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# NLTK for sentiment analysis
&lt;/span&gt;&lt;span class="n"&gt;nltk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;download&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;vader_lexicon&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;sia&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;SentimentIntensityAnalyzer&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Function to analyze text with BERT
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;analyze_text_with_bert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;inputs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;tokenizer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;return_tensors&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;pt&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;padding&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;truncation&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;512&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;outputs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;model&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;inputs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;predictions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;functional&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;softmax&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;outputs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;logits&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="o"&gt;=-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;predictions&lt;/span&gt;

&lt;span class="c1"&gt;# Function for syntactic analysis using spaCy
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;syntactic_analysis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;doc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;nlp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;doc&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dep_&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; (&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;head&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;)&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Function for sentiment analysis using NLTK
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;sentiment_analysis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;sentiment_scores&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sia&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;polarity_scores&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Sentiment: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;sentiment_scores&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Basic function to combine different analyses
&lt;/span&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;nlu_system&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Analyzing: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Syntactic Analysis
&lt;/span&gt;    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Syntactic Analysis (spaCy):&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;syntactic_analysis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Sentiment Analysis
&lt;/span&gt;    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;Sentiment Analysis (NLTK):&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;sentiment_analysis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# BERT Analysis (classification)
&lt;/span&gt;    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;BERT-based Text Analysis:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;predictions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;analyze_text_with_bert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Predictions: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;predictions&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Example usage
&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;sample_text&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The movie was fantastic, but the ending was a bit disappointing.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
    &lt;span class="nf"&gt;nlu_system&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sample_text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. &lt;strong&gt;Explanation of the Code&lt;/strong&gt;
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Components:
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;BERT-based Analysis&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;analyze_text_with_bert&lt;/code&gt; function uses a pre-trained BERT model for sequence classification (e.g., sentiment analysis, question answering, or general text classification).&lt;/li&gt;
&lt;li&gt;It tokenizes the input text and uses a BERT model to analyze it, returning the output predictions.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Syntactic Analysis with spaCy&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;syntactic_analysis&lt;/code&gt; function uses spaCy to parse the input text and provide a dependency tree, identifying syntactic relationships between words (subject, object, verb, etc.).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Sentiment Analysis with NLTK&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;sentiment_analysis&lt;/code&gt; function uses NLTK’s VADER model for basic sentiment analysis (positive, negative, neutral).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;NLU System&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;nlu_system&lt;/code&gt; function combines these components and outputs the analysis for a given piece of text.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Scaling Up the System&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;To build the system as described in your earlier inquiry, you would need to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Expand the BERT model&lt;/strong&gt; to handle multi-task learning, such as Named Entity Recognition (NER), Question Answering, and Text Summarization.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fine-tune models&lt;/strong&gt; on specific datasets to handle domain-specific text and multi-lingual contexts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add Pragmatics&lt;/strong&gt;: Implement specific logic for cultural nuances and idiomatic expressions. This may involve custom datasets or specific attention mechanisms in your transformer models.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integrate Knowledge Graphs&lt;/strong&gt; to provide real-world context to the NLU system. This could be done by adding knowledge retrieval functions from external sources like Wikidata or custom-built knowledge graphs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Continuous Learning&lt;/strong&gt;: Incorporate reinforcement learning techniques to allow the system to adapt to new text as it interacts with users.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This basic framework provides the backbone for larger, more complex NLU tasks, and you can grow it by implementing more specific models, handling additional languages, and introducing components like contextual memory or dialogue systems.&lt;/p&gt;

&lt;p&gt;Advanced NLU at &lt;a href="https://insightshub.in/how-to-create-a-human-level-natural-language-understanding-nlu-system/#:~:text=or%20dialogue%20systems.-,Advanced%20NLU,-Let%E2%80%99s%20elaborate%20on" rel="noopener noreferrer"&gt;Advanced NLU Integration&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>ai</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
