add red carpet for optional markdown and some css fixes

Changed files
+38 -9
app
assets
config
stylesheets
helpers
javascript
views
action_markdown
articles
config
+2
Gemfile
··· 73 73 gem "capybara" 74 74 gem "selenium-webdriver" 75 75 end 76 + 77 + gem "redcarpet", "~> 3.6"
+2
Gemfile.lock
··· 218 218 rake (13.2.1) 219 219 rdoc (6.6.3.1) 220 220 psych (>= 4.0.0) 221 + redcarpet (3.6.0) 221 222 regexp_parser (2.9.0) 222 223 reline (0.5.2) 223 224 io-console (~> 0.5) ··· 281 282 pry 282 283 puma (>= 5.0) 283 284 rails (~> 7.1.3, >= 7.1.3.2) 285 + redcarpet (~> 3.6) 284 286 selenium-webdriver 285 287 sprockets-rails 286 288 sqlite3 (~> 1.4)
+1
app/assets/config/manifest.js
··· 1 1 //= link_tree ../images 2 + //= link_tree ../fonts 2 3 //= link_directory ../stylesheets .css 3 4 //= link_tree ../../javascript .js 4 5 //= link_tree ../../../vendor/javascript .js
+16 -6
app/assets/stylesheets/application.css
··· 17 17 @font-face { 18 18 font-family: 'Raleway'; 19 19 font-weight: 400; 20 - src: url('Raleway-VariableFont_wght.ttf'); 20 + src: url("Raleway-VariableFont_wght.ttf"); 21 21 } 22 22 23 23 @font-face { 24 24 font-family: 'Gudea'; 25 - src: url ('Gudea-Regular.ttf') 25 + src: url("Gudea-Regular.ttf") 26 26 } 27 27 28 28 body { 29 29 background: url('bg5.jpg') repeat; 30 - font: 1em 'Raleway', 'courier new'; 30 + font-family: 'Raleway', 'sans-serif'; 31 + font-size: 1.1rem; 31 32 } 32 33 33 34 .main { ··· 47 48 48 49 a:link, a:link:active, a:visited, a:visited:active { 49 50 color: #509145; 50 - font-family: 'Gudea', sans-serif 51 + font-family: inherit; 51 52 } 52 53 53 54 a:hover { ··· 144 145 margin: 1em 0 1em 0; 145 146 } 146 147 147 - .article_date { 148 + div.article_date { 148 149 /* color: #4f6599; */ 149 150 text-transform: lowercase; 150 151 font-family: 'Gudea', sans-serif; 152 + margin-top:1em; 153 + font-size:1.1rem; 151 154 } 152 155 153 156 div.article_date_text { ··· 167 170 } 168 171 169 172 .pbody code.inline { 170 - display: inline-block; 173 + font-family: 'Gudea', sans-serif; 174 + display: inline-block; 171 175 } 172 176 173 177 .pbody code { 178 + font-family: 'Gudea', sans-serif; 174 179 color: #509145; 175 180 padding-left: 2em; 176 181 display: block; ··· 179 184 margin-top: 1em; 180 185 } 181 186 187 + span.tag_link { 188 + font-family: 'Gudea', sans-serif; 189 + display: inline-block; 190 + font-size: 1em; 191 + }
+7
app/helpers/application_helper.rb
··· 1 1 module ApplicationHelper 2 + 3 + def markdown(text) 4 + options = [:hard_wrap, :autolink, :no_intra_emphasis, :fenced_code_blocks, :underline, 5 + :highlight, :safe_links_only, :prettify, :no_styles] 6 + Markdown.new(text, *options).to_html.html_safe 7 + end 8 + 2 9 end
+1
app/javascript/application.js
··· 1 1 // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails 2 2 3 3 import * as AsciinemaPlayer from 'asciinema-player'; 4 + import "@github/markdown-toolbar-element"
+3
app/views/action_markdown/contents/_content.html.erb
··· 1 + <div class="action-markdown"> 2 + <%= sanitize content.to_html %> 3 + </div>
+1 -1
app/views/articles/_form.html.erb
··· 9 9 10 10 <div> 11 11 <%= form.label :body %><br> 12 - <%= form.text_area :body %><br> 12 + <%= form.text_area :body, style: "width: 100%; height: 50vh;", rows: 8 %><br> 13 13 <% article.errors.full_messages_for(:body).each do |message| %> 14 14 <div><%= message %></div> 15 15 <% end %>
+4 -2
app/views/articles/show.html.erb
··· 6 6 <%= image_tag url_for(@article.icon) %> 7 7 <% end %> 8 8 9 - <p class="article_date"><div class="article_date_text"><%= @article.created_at.strftime('%Y %b %d') %></div> | <%= link_to @article.tag.name, @article.tag %></p> 9 + <div class="article_date"> 10 + <div class="article_date_text"><%= @article.created_at.strftime('%Y %b %d') %></div> <span class="tag_link">| <%= link_to @article.tag.name, @article.tag %></span> 11 + </div> 10 12 11 - <div class="pbody"><%== @article.body %></div> 13 + <div class="pbody"><%== markdown(@article.body) %></div> 12 14 13 15 <% if user_signed_in? %> 14 16 <p>
+1
config/importmap.rb
··· 2 2 3 3 pin "application" 4 4 pin "asciinema-player" # @3.8.1 5 + pin "@github/markdown-toolbar-element", to: "https://ga.jspm.io/npm:@github/markdown-toolbar-element@2.1.1/dist/index.js"