![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
A simple Rails blog engine powered by Markdown.
Postmarkdown is compatible with Rails 3 only and the gem is hosted on RubyGems.org.
Simply add Postmarkdown to your Gemfile and bundle it up:
gem 'postmarkdown'
Then, run the generator to setup Postmarkdown for your application:
$ rails generate postmarkdown:install
The above command performs the following actions:
app/posts/
. This directory is where your markdown files will live.app/posts/2011-01-01-example-post.markdown
./posts/*
, to customize these routes check out the Customizing Routes section below.Here's an example of how to generate a new post using a slug and publish date:
$ rails generate postmarkdown:post test-post --date=2011-01-01
The above command will create the file app/posts/2011-01-01-test-post.markdown
, which you can edit and add content to.
Open http://localhost:3000/posts
in your browser and you should be able to navigate to your new post. The URL for your new post is http://localhost:3000/posts/2011/01/01/test-post
.
The easiest way to customize the Postmarkdown functionality or appearance is by using the override generator. This generator can copy files from the Postmarkdown core and place them into your Rails app. For example:
$ rails generate postmarkdown:override --all # overrides all of the things
$ rails generate postmarkdown:override --controller # overrides `app/controllers/posts_controller.rb`
$ rails generate postmarkdown:override --model # overrides `app/models/post.rb`
$ rails generate postmarkdown:override --views # overrides all files in directory `app/views/posts/`
$ rails generate postmarkdown:override --theme # overrides the layout and stylesheet
Postmarkdown comes prepared with a fully functional RSS feed.
You can take advantage of the built-in feed by adding the feed link to your HTML head tag. For example, simply add the following to your default layout:
<head>
<!-- include your stylesheets and javascript here... -->
<%= yield :head %>
</head>
To customize the feed title, add the following to an initializer (config/initializers/postmarkdown.rb
):
Postmarkdown::Config.options[:feed_title] = 'Custom Blog Title Goes Here'
To link to the feed in your app, simply use the route helper: <%= link_to 'RSS Feed', posts_feed_path %>
By default, Postmarkdown will use your application's default layout, but if you wish to use a specific custom layout, you can set the following configuration in an initializer (config/initializers/postmarkdown.rb
):
Postmarkdown::Config.options[:layout] = 'layout_name'
Postmarkdown comes with minimal built-in theme for your convenience.
Postmarkdown::Config.options[:layout] = 'postmarkdown'
Postmarkdown supports fenced code blocks which allows you to add syntax highlighting with an optional language identifier. For example, to syntax highlight Ruby code:
```ruby
require 'some_gem'
class RubyClass
def some_method
puts "string"
end
end
```
This will add CSS classes to the HTML, but you still need to a stylesheet to visually highlight the code. Postmarkdown ships with a GitHub-like set of styles.
In your app/assets/stylesheets/application.css
, include the CSS file:
/*
*= require postmarkdown/syntax/github
*/
Or if you're using SCSS:
@import "postmarkdown/syntax/github";
Postmarkdown adds highlighting to your code using Rouge. See the demo page for supported languages and styles.
By default Postmarkdown will setup all routes to go through the /posts/*
path. For example:
http://example.com/posts # lists all posts
http://example.com/posts/2011 # lists all posts from 2011
http://example.com/posts/2011/01 # lists all posts from January 2011
http://example.com/posts/2011/01/01 # lists all posts from the 1st of January 2011
http://example.com/posts/2011/01/01/test-post # show the specified post
You can change the default route path by modifying the 'postmarkdown' line in routes.rb
. For example:
postmarkdown :as => :blog
This will produce the following routes:
http://example.com/blog # lists all posts
http://example.com/blog/2011 # lists all posts from 2011
http://example.com/blog/2011/01 # lists all posts from January 2011
http://example.com/blog/2011/01/01 # lists all posts from the 1st of January 2011
http://example.com/blog/2011/01/01/test-post # show the specified post
You can also customize the posts#show
route via the :permalink_format
option:
postmarkdown :as => :blog, :permalink_format => :day # URL: http://example.com/blog/2011/01/01/test-post
postmarkdown :as => :blog, :permalink_format => :month # URL: http://example.com/blog/2011/01/test-post
postmarkdown :as => :blog, :permalink_format => :year # URL: http://example.com/blog/2011/test-post
postmarkdown :as => :blog, :permalink_format => :slug # URL: http://example.com/blog/test-post
What about mapping Postmarkdown to root? We got you covered:
postmarkdown :as => ''
root :to => 'posts#index'
By default, Postmarkdown will only show posts that are dated on or before today. If you're writing a post to be published sometime in the future, you won't be able to view it in the browser.
To override this behaviour, add the following to an initializer
(config/initializers/postmarkdown.rb
):
Postmarkdown::Config.options[:allow_preview] = true
With the :allow_preview option set, you'll be able to view individual posts by their URL but they will remain hidden from the index and feed until the post date.
├── app
│ ├── controllers
│ ├── helpers
│ ├── mailers
│ ├── models
│ ├── posts (where your markdown files live)
│ │ ├── 2011-04-01-example-1.markdown
│ │ ├── 2011-04-02-example-2.markdown
│ │ ├── 2011-04-03-example-3.markdown
│ │ ├── 2011-04-04-example-4.markdown
│ └── views
│ └── posts (overridable)
│ ├── _feed_link.html.haml
│ ├── _post.html.haml
│ ├── feed.xml.builder
│ ├── index.html.haml
│ └── show.html.haml
bundle
rake appraisal:install
rake # run the tests
MIT License. Copyright 2011 Ennova.
FAQs
Unknown package
We found that postmarkdown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.