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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


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


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.


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.


                <div id="root"></div>



                body, html, div{
  padding: 0;
  margin: 0;

  box-sizing: border-box;

  display: grid;
  height: 100vh;
  width: 100%;
  display: grid;
  grid-template-columns: 3fr 4fr;
  grid-template-areas: 'editor preview';

#editor, #editor:focus{
  grid-area: editor;
  height: 100%;
  width: 100%;
  padding: 20px;
  background: #002b36;
  border: none;
  font-size: 16px;
  color: #fdf6e3;
  font-family: 'Inconsolata', monospace;
  outline: none;

  grid-area: preview;
  font-family: 'Open Sans', sans-serif;
  padding: 40px;
  overflow-y: scroll;

#preview img{
  width: 100px;
  margin: 20px;
  vertical-align: middle;

 pre, code {
   font-family: 'Inconsolata', monospace;
   background: #272822;
   color: #eee8d5;
   padding: 2px 5px;
   border-radius: 2px;

  padding: 15px;
  border-radius: 5px;

  font-size: 14px;
  background: #f7f7f7;
  padding: 5px 10px;
  border-left: 3px solid #121212;


                // Using Redux for a project as simple as this is overkill, but is done nonetheless for the sake of practice

// Declartions
const {useState} = React;
const {createStore} = Redux;
const {Provider, connect} = ReactRedux;

const INPUT = 'INPUT';

// Redux
const inputAction = (value) => ({
  type: INPUT,
  payload: value

const initialDoc = `# React-Redux Markdown Previewer!

## Redux was Overkill
### But I used it anyways

Interestingly the HTML only has **one element**, \`<div id="root"></div>\`

// but the javascript is filled with many functions like this:

const mapStateToProps = state => ({
  textareaInput: state.textareaInput

I like to listen to Eminem when I code sometimes
> You gotta find that inner strength to pull that shit out of you, and get that motivation to not give up and not be a quitter!

[Google can be quite helpful!](

Technologies used
- React
- Redux
  - React-Redux


const initState = {
  textareaInput: initialDoc

const inputReducer = (state=initState, action) => {
    case INPUT:
      return {
        textareaInput: action.payload
      return state;

// Editor Component
const Editor = (props) => {
  textareaChanged = (e) => {
    <div className="editor-container">
      <textarea id="editor" name="textarea" value={props.textareaInput} onChange={textareaChanged} />

// Preview Component
const Preview = (props) => {
  markdown = marked(props.textareaInput);
    <div id="previewContainer">
      <div id="preview" dangerouslySetInnerHTML={{__html: markdown}}></div>

const mapStateToProps = state => ({
  textareaInput: state.textareaInput

const mapDispatchToProps = dispatch => ({
  setInput: val => {

const ConnectedEditor = connect(mapStateToProps, mapDispatchToProps)(Editor);
const ConnectedPreview = connect(mapStateToProps, mapDispatchToProps)(Preview);

// Main Render
const store = createStore(inputReducer, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__());

const App = () => {
  return (
    <Provider store={store}>
      <div className="main-container">
ReactDOM.render(<App/>, document.getElementById('root'));