Markdown and Code Highlighting with Redcarpet Gem

Ruby on Rails, Gems, Markdown

Check it out!

A couple-gem addition to this site for code-highlighting and markdown syntax to HTML.

Made Possible with Redcarpet gem!

This is a quick little project record in order to test the markdown and code highlighting. I did this with the following packages:

Here is some Ruby code from my ProjectsController.rb:

class ProjectsController < ApplicationController
    before_action :find_project, only: [:show, :edit, :update, :destroy]

    def index
        @projects = Project.all.order("created_at DESC")
    end

    def new
        @project = Project.new
    end

    def create
        @project = Project.new project_params

        if @project.save
            redirect_to @project, notice: "You created a project, Logan!"
        else
            render 'new', notice: "Oh nooooo! Couldn't create project, Logan."
        end
    end

    def show
    end

    def edit
    end

    def update
        if @project.update project_params
            redirect_to @project, notice: "Project updated, baby."
        else
            render 'edit'
        end
    end

    def destroy
        @project.destroy
        redirect_to projects_path
    end

    private

    def project_params
        params.require(:project).permit(:title, :content)
    end

    def find_project
        @project = Project.find(params[:id])
    end
end

See how it's highlighted properly? Cool!

Another (in PHP)

<?php
public function greatSmile($name) {
    echo "You have a great smile, " . $name . "!";
}
?>

Projects Check out some of my latest projects.
PHP, Ruby on Rails, Python, Painting, and Go