[RUBY] I made a gem to post the text of org-mode to qiita

Mac OS X-10.13.3ruby-2.7.0p0qiita_orgversion

Introduction

qiita \ _org is a gem that posts text written in emacs org-mode to Qiita. I created it based on the idea that it would be nice if cui could be used to create and post articles.

This article describes a usage example of qiita \ _org, how to install and initialize it. Please refer to https://qiita.com/yamatoken/items/9314161758e778fd82c0 for the command of qiita \ _org.

Note: Since command \ _line is used, please set the ruby version to 2.4.0 or higher. We also recommend emacs version 26.3 or higher.

In windows, we have confirmed the operation in the following environment.

OS: Windows 10 homeUbuntu20.04.1ruby-2.7.1p83

However, please enter'n'on MacOS when executing qiita template.

Example of use

First, get the post template of org-mode. Type'qiita template', decide whether to write the environment, and create template.org. ![img](// qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/76dc9d92-3a77-5523-7a21-571f691402bb.png)

Then, such an org is created. ![img](// qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/4a38e62f-9cae-1bf1-ee51-080706c64f6f.png)

Change the title and tag here to those for putting on qiita, and then just write the text as before.

Once the text is created, all you have to do is execute the posting command. When I try to post to the limited shared post, it looks like this. ![img](// qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/3f7179f4-e150-7a63-b8ba-e936b925d7be.png)

It will appear sloppy, but if the settings are done properly, the posting will be completed and the page posted in Safari will open.

The posted article will show you in which directory the original org text is located as Source, which should be useful even if you want to edit a previous article. .. ..

Installation method

gem install qiita_org

If qiita and the list of commands are displayed, the installation is completed successfully.

Initial setting

install pandoc

on mac

brew install pandoc

ubuntu

sudo apt update
sudo apt install pandoc

Creating a configuration file

qiita config global

And create a configuration file in your home directory.

How to create Qiita access token and write to configuration file

At https://qiita.com/settings/applications

Click'Issue a new token'for your personal access token. ![img](// qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/de93b61e-b42d-8364-7282-ee1bdbd572ad.png)

Write a description of the access token, and check all the scopes as shown in the image. Then issue it. ![img](// qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/612049/7012077d-fba8-e823-d29c-dc93939b4d6b.png)

When the page moves, the access token is displayed in the personal access token, so copy it. (Please note that this character string cannot be displayed again when the page is moved.)

Return to the terminal and execute as follows.

qiita config global access_token 'your accesstoken'

Paste the access token you copied earlier in place of'your access token'.

Name registration

qiita config global name 'your name'

Email address registration

qiita config global email 'your email'

Qiita Team URL registration

It is necessary to use the option called'teams', so if you have a Qiita Team to which you belong, please do this setting. If not, you don't have to set it.

qiita config global teams_url 'https://foge.qiita.com/'

Be careful not to forget to add a'/' at the end of the URL.

ox-qmd settings

See the article below for more information on ox-qmd. Reference: I made a package to export Qiita compliant Markdown from Org-mode

https://github.com/0x60df/ox-qmd ox-qmd.el'~ / .emacs.d / site Create it in \ _lisp'.

To put it in the PATH to emacs, add the following to init.el.

init.el


;;Set the location of el files
(setq load-path (cons "~/.emacs.d/site_lisp" load-path))

...

(require 'ox-qmd)
(add-to-list 'ox-qmd-language-keyword-alist '("ruby" . "ruby"))

How to create a local config file

If you belong to multiple Teams, or if you want to set an email address for each directory, you can specify a local configuration file.

In the directory where you want to create the configuration file

qiita config local set

And you can write in the same way as the above initial settings.


Recommended Posts

I made a gem to post the text of org-mode to qiita
I made a tool to output the difference of CSV file
I tried JAX-RS and made a note of the procedure
I made a GitHub Action that makes it easy to understand the execution result of RSpec
Make a margin to the left of the TextField
I want to var_dump the contents of the intent
I made a Docker container to run Maven
What I tried when I wanted to get all the fields of a bean
I was a little addicted to the S3 Checksum comparison, so I made a note.
I made a sample of how to write delegate in SwiftUI 2.0 using MapKit
I managed to get a blank when I brought the contents of Beans to the textarea
I want to recursively get the superclass and interface of a certain class
I made a Docker image of SDAPS for Japanese
[Ruby] I want to make a program that displays today's day of the week!
I made a check tool for the release module
I was addicted to the record of the associated model
I tried to summarize the state transition of docker
Let's write a Qiita article in org-mode of Emacs !!
I tried to create a log reproduction script at the time of apt install
I tried to decorate the simple calendar a little
I made a method to ask for Premium Friday
05. I tried to stub the source of Spring Boot
I want to know the answer of the rock-paper-scissors app
I want to display the name of the poster of the comment
[SwiftUI] How to specify the abbreviated position of Text
I wrote a sequence diagram of the j.u.c.Flow sample
[Rails] I want to display the link destination of link_to in a separate tab
I learned about the existence of a gemspec file
A memorandum because I was addicted to the setting of the Android project of IntelliJ IDEA
I want to be aware of the contents of variables!
I want to return the scroll position of UITableView!
I want to add a delete function to the comment function
I made Togmarks, which allows the second year of junior high school to vote for their ideas in a week.
When I switched to IntelliJ, I got a lot of differences in the encoding of the properties file.
I want to get a list of the contents of a zip file and its uncompressed size
Display a balloon message in BarButtonItem of NavigationBar with a size according to the amount of text.
I made the server side of an online card game ①
I made a Japanese version of Rails / devise automatic email
I made a server side of an online card game ⑤
I took a peek at the contents of Java's HashMap
I tried to summarize the basics of kotlin and java
I want to expand the clickable part of the link_to method
[Beginner] I made a program to sell cakes in Java
I made a server side of an online card game ⑥
I want to make a specific model of ActiveRecord ReadOnly
I want to change the log output settings of UtilLoggingJdbcLogger
[Swift] I tried to implement the function of the vending machine
I want to call a method and count the number
I want to create a form to select the [Rails] category
I made a server side of an online card game ④
I tried to summarize the basic grammar of Ruby briefly
I was addicted to the setting of laradock + VSCode + xdebug
[Ruby] How to retrieve the contents of a double hash
I want to give a class name to the select attribute
I tried to build the environment of WSL2 + Docker + VSCode
I made a server side of an online card game ②
I tried to make a client of RESAS-API in Java
I want to narrow down the display of docker ps
[jsoup] How to get the full amount of a document
[Ruby] I want to reverse the order of the hash table
I want to temporarily disable the swipe gesture of UIPageViewController