Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- <head>
   
</head> -->

<body>
    <noscript>You need to enable JavaScript to run this app.</noscript>
    <div id="root"></div>
    <script src="https://unpkg.com/tailwindcss-jit-cdn"></script>
</body>
              
            
!

CSS

              
                h1,
h2,
h3,
h4,
h5,
h6 {
    font-size: revert;
    font-weight: revert;
}
a {
    text-decoration: revert;
}

blockquote {
    border-left: 3px solid #224b4b;
    color: #224b4b;
    padding-left: 5px;
    margin-left: 25px;
}

> p > code {
    padding: 3px;
}

code {
    background: white;
    font-size: 0.875rem;
    font-weight: bold;
}

pre {
    display: block;
    overflow: auto;
    background: white;
    padding: 5px;
    line-height: 1.2;
}

              
            
!

JS

              
                import React, { useState } from "https://cdn.skypack.dev/react@17.0.1";
import ReactDOM from "https://cdn.skypack.dev/react-dom@17.0.1";

function App() {
    const str = `
  This is a paragraph

  **This is bolded text**

  > Block Quotes!

  # Heading 1
  ## Heading 2
  ### Heading 3
  - list item 1
  - list item 2
  - list item 3


  [Visit my twitter account](https://twitter.com/AbdulrahmanDev)

  This is a inline \`<div></div>\`
  This is a block of code:

  \`\`\`
    let x = 1;
    let y = 2;
    let z = x + y;
  \`\`\`

  ![React](data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ii0xMS41IC0xMC4yMzE3NCAyMyAyMC40NjM0OCI+CiAgPHRpdGxlPlJlYWN0IExvZ288L3RpdGxlPgogIDxjaXJjbGUgY3g9IjAiIGN5PSIwIiByPSIyLjA1IiBmaWxsPSIjNjFkYWZiIi8+CiAgPGcgc3Ryb2tlPSIjNjFkYWZiIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiPgogICAgPGVsbGlwc2Ugcng9IjExIiByeT0iNC4yIi8+CiAgICA8ZWxsaXBzZSByeD0iMTEiIHJ5PSI0LjIiIHRyYW5zZm9ybT0icm90YXRlKDYwKSIvPgogICAgPGVsbGlwc2Ugcng9IjExIiByeT0iNC4yIiB0cmFuc2Zvcm09InJvdGF0ZSgxMjApIi8+CiAgPC9nPgo8L3N2Zz4K)
`;
    const [text, setText] = useState(str);
    marked.setOptions({
        breaks: true,
        highlight: function (code) {
            return Prism.highlight(
                code,
                Prism.languages.javascript,
                "javascript"
            );
        }
    });
    const markdown = marked(text, { breaks: true });
    return (
        <div className="bg-[#B3C8D8] min-h-screen py-8 text-center">
            <div className="">
                <h1 className="text-2xl text-[#323E48] font-bold  sm:text-4xl md:text-5xl md:font-black lg:text-6xl">
                    Markdown Previewer Project
                </h1>
            </div>

            <div className="mt-5 space-y-8 px-5 md:px-0">
                <div className="mx-auto max-w-xl">
                    <textarea
                        value={text}
                        onChange={(e) => setText(e.target.value)}
                        id="editor"
                        rows="20"
                        type="text"
                        className="bg-[#98AFC0] border-none rounded w-full"
                    />
                </div>
                <div className="mx-auto max-w-5xl">
                    <div
                        id="preview"
                        class="bg-[#98AFC0] p-8 text-left"
                        dangerouslySetInnerHTML={{ __html: markdown }}
                    />
                </div>
            </div>
        </div>
    );
}

ReactDOM.render(<App />, document.getElementById("root"));

              
            
!
999px

Console