Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

<html lang="en">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="theme-color" content="#000000">
    <link href="" rel="stylesheet">
    <title>Build a Markdown Previewer</title>
      You need to enable JavaScript to run this app.
    <div id="root"></div>
    <script src=""></script>
    <script src=""></script>

              body {
  line-height: 1.5em;
  background-color: #eaf8bf;


.App {
  display: grid;
  grid-template-columns: 1;
  grid-template-rows: 4;
  grid-template-areas: 'header' 'editor' 'viewer' 'footer1';
  grid-gap: 10px;

header>h1 {

label {

  content:" \2193";

#editor {
  width: 100%;
  height: 100%;
  min-height: 18em;

  width: 100%;
  min-height: 15em;
  border: solid;
  border-color: $grey-color;
  box-sizing: padding-box;

#previewBox {
  background-color: $lighter-blue-color;
  border: solid;
  border-color: $grey-color;

#preview {
  text-align: left;
  margin-left: 3px;

@media screen and (min-width:800px) {
  .App {
    grid-template-columns: 1fr 2fr;
    grid-template-rows: 3;
    grid-template-areas: 'header header' 'editor viewer' 'footer1 footer1';
  header {
    grid-area: header;
  #editorBox {
    grid-area: editor;
  #previewBox {
    grid-area: viewer;

table, td, th {

blockquote p{
  border-left:solid 2px $yellow-color;

  pre, code{

#footerInReact {
  text-align: center;
  border-top: 1px solid rgb(53, 53, 63);
  max-height: max-content;
  grid-area: footer1;
  margin-top: -10px;

    a img {
      margin-bottom: -0.2em;

//import React from 'react';
//import ReactDOM from 'react-dom';
//import {Provider} from 'react-redux';
const { createStore, applyMiddleware,combineReducers } = Redux;
const { Provider, connect } = ReactRedux
const thunk = ReduxThunk.default


const footer=`
<h5 class="textcenter">Made by
                <a href="" target="_blank">Ion Varsescu</a>
<section id="contact">
  <a href="" target="_blank">
    <i class="fa fa-facebook-square fa-3x"></i>
  <a href="" target="_blank">
    <i class="fa fa-twitter fa-3x"></i>
  <a href="" target="_blank">
    <i class="fa fa-linkedin fa-3x"></i>
  <a href="" target="_blank">
    <i class="fa fa-google-plus fa-3x"></i>
  <a href="" target="_blank">
    <i class="fa fa-github fa-3x"></i>
  <a href="" target="_blank">
    <img src="" />

const allText = (text) => dispatch => {
    console.log("text in action1 alltext : ",text);
    dispatch ({
        type: NEWTEXT,
        fullText: text

let a=`# Welcome to my React Markdown Previewer!

## This is a sub-heading...
### And here's some other cool stuff:
Heres some code, \`<div></div>\`, between 2 backticks.

// this is multi-line code:

function anotherExample(firstLine, lastLine) {
  if (firstLine == \'\`\`\`\' && lastLine == \'\`\`\`\') {
    return multiLineCode;


You can also make text **bold**... whoa! 
Or _italic_.
Or... wait for it... **_both!_**
And feel free to go crazy ~~crossing stuff out~~.

There's also [links](, and
> Block Quotes!

And if you want to get really crazy, even tables:

Wild Header | Crazy Header | Another Header?
------------ | ------------- | ------------- 
Your content can | be here, and it | can be here....
And here. | Okay. | I think we get it.

- And of course there are lists.
  - Some are bulleted.
     - With different indentation levels.
        - That look like this.

1. And there are numbererd lists too.
1. Use just 1s if you want! 
1. But the list goes on...
- Even if you use dashes or asterisks.
* And last but not least, let's not forget embedded images:

![React Logo w/ Text](`;

const showText = (state = a,action) => {
    switch (action.type) {
        case NEWTEXT:
        console.log("new state");
        console.log("fullText after dispatch",action.fullText);
        return action.fullText;
        console.log("old state");
        return state;
console.log("showText in reducer ",showText);

//import {combineReducers} from 'redux';

const rootReducer=combineReducers({

//import React, { Component } from 'react';
//import './App.css';
//import { connect } from 'react-redux';
//import { allText } from './actions/action1';
//import marked from 'marked';
//import { footer } from './constants';

class Footer extends React.Component {

  render() {
    function createFooter(a) {
      return { __html: a }
    return (
      <div id="footerInReact" dangerouslySetInnerHTML={createFooter(footer)}>

class App extends React.Component {
  constructor(props) {
    //version 2:the line above is not needed because I update fields directly from Redux - dumb component
    this.handleChange = this.handleChange.bind(this);

  handleChange(event) {
    console.log("event value in handlechange: ",;
      version 2: this.setState - is not needed  because I update fields directly from Redux   */

  render() {

    //in markdown, open a link in a new window
    const renderer = new marked.Renderer();
    const linkRenderer =; = (href, title, text) => {
      const html =, href, title, text);
      return html.replace(/^<a /, '<a target="_blank" rel="nofollow" ');

      tables: true,
      gfm: true,
      breaks: true,

    let d = marked(this.props.input.showText, { renderer });

    function createMarkup(a) {
      return { __html: a }

    return (
      <div className="App">
          {/*<img src={logo} className="App-logo" alt="logo" />*/}
          <h1>Markdown Previewer</h1>
        <div id="editorBox">
        <label id="editorBoxLabel">Write markdown here:</label>
          <textarea id="editor" value={this.props.input.showText} onChange={this.handleChange} autoFocus />
          {/*version 2: in line above value={this.state.showText} if I update field from React*/}
        <div id="previewBox">
        <label id="previewBoxLabel">This is how it looks:</label>
          <div id="preview" dangerouslySetInnerHTML={createMarkup(d)} />
        {/*version 2: in line above {this.state.showText} instead if I update field from React*/}
        <Footer />

const mapStateToProps = (state) => {
  return { input: state }

const mapDispatchToProps = (dispatch) => {
  return {
    submitNewInput: (text) => {
      console.log("text in mapDispatch: ", text);

const Container = connect(mapStateToProps, mapDispatchToProps)(App);

//import {createStore,applyMiddleware} from 'redux';
//import thunk from 'redux-thunk';

const reduxStore = createStore(rootReducer,applyMiddleware(thunk));

<Provider store={reduxStore}>
<Container />
</Provider>, document.getElementById('root'));

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.