Help us understand the problem. What is going on with this article?

Qiita::Markdownを使う on Yosemite

More than 5 years have passed since last update.

TL;DR

install

gem 'qiita-markdown'
% budle install

Native Extensionsのbuildに失敗したら、各種依存ライブラリを準備する必要がある。

charlock_holmes

build失敗メッセージに従い、Homebrewで icu4c をインストールする。

% brew install icu4c

rugged

Homebrewで cmake をインストールする。

% brew install cmake

nokogiri

emojiを準備する

diff --git a/Rakefile b/Rakefile
index 2cea5c9..64965dc 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,4 +1,5 @@
 require 'rake/testtask'
+load 'lib/tasks/emoji.rake'

 task :default => :test
  • bundle exec rake emoji
  • public/images/emoji 以下に画像ができる
  • Rails Appの public/images 以下に移動

qiita-markdowngemoji に依存しているので、gemのディレクトリに移動して作業してもよい。

usage

# processorを準備(このとき必要ならオプションを渡す)
processor = Qiita::Markdown::Processor.new
# markdown : renderしたいmarkdown文字列
result = processor.call(markdown)
# html-pipelineのHTMLツリーをHTMLに
output = result[:output].to_s
# viewに出力
output.html_safe
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした