Ostatnie spojrzenie

by msypniewski511 in Markdown

Overview

Nearly all Markdown applications support the basic syntax outlined in the original Markdown design document. There are minor variations and discrepancies between Markdown processors — those are noted inline wherever possible.


An old rock in the desert


Using rails helper Web-Crunch

module ApplicationHelper
  require 'redcarpet/render_strip'

  def has_role?(role)
    current_user && current_user.has_role?(role)
  end
  class CodeRayify < Redcarpet::Render::HTML
    def block_code(code, language)
      language ||= 'ruby'
      CodeRay.scan(code, language).div
    end
  end

  def markdown(text)
    coderayified = CodeRayify.new(:hard_wrap => true)
    options = {
      fenced_code_blocks: true,
      no_intra_emphasis: true,
      autolink: true,
      lax_html_blocks: true,
      lax_spacing: true
    }
    markdown_to_html = Redcarpet::Markdown.new(coderayified, options)
    markdown_to_html.render(text).html_safe
  end

  def strip_markdown(text)
    markdown_to_plain_text = Redcarpet::Markdown.new(Redcarpet::Render::StripDown)
    markdown_to_plain_text.render(text).html_safe
  end
end

source: GITHUB

Headers

# H1
## H2
### H3

#### H4
##### H5
###### H6

Alternatively, for H1 and H2, an underline-ish style:

Alt-H1
======

Alt-H2
------

# H1

H1


## H2
### H3
#### H4
### H3 dwa
### H3 trzy
# H3
##### H5
###### H6
Alternatively, for H1 and H2, an underline-ish style:

# Alt-H1
## Alt-H2

Emphasis

Emphasis, aka italics, with *asterisks* or _underscores_.

Strong emphasis, aka bold, with **asterisks** or __underscores__.

Combined emphasis with **asterisks and _underscores_**.

Strikethrough uses two tildes. ~~Scratch this.~~

Emphasis, aka italics, with asterisks or underscores.

Strong emphasis, aka bold, with asterisks or underscores.

Combined emphasis with asterisks and underscores_.

Strikethrough uses two tildes. ~~Scratch this.~~

0 Replies


Leave a replay

To replay you need to login. Don't have an account? Sign up for one.