Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(app): 最新のtextlintを取り込み、npmパッケージ化できるようにしました. #9

Merged
merged 2 commits into from
Jul 21, 2018

Conversation

mtgto
Copy link
Contributor

@mtgto mtgto commented Jul 21, 2018

はじめまして。
突然のPull Request失礼いたします。

この度貴社のmaildownを拝見させていただきまして、非常に感銘を受けました。
弊社でもメモをMarkdownで書くことがあるのですが、そのあとメールやSlack、Wikiなどに書き起こす際にかかる手間を減らしてくれる大変有望なライブラリであるという声が(私から)上がっております。

その特性をChrome拡張やElectronアプリなどでライブラリとして利用できないかと思い、
不躾ではありますがNPMパッケージとして利用できるように対応を行いました。

なお、最新のtextlintを取り込んだことにより fs.readdirSync 関数がない非Node.js環境で動かすことが難しくなったため、index.jsをtextlintの公式サイトのデモでも利用している https://github.com/textlint/playground の手法を利用し、@textlint/kernel を呼び出す方法に変更しております。ご了承ください。
playground内のTextlintEditor.jsで使っている方法です)。
ちなみにブラウザで動くtextlintの検討は textlint/textlint#299 でされております。

もしよろしければNPMパッケージとしての公開につきましてもご検討いただけると幸いでございます。

NPMパッケージとしてはこのように利用できます(Pull Request元のブランチで yarn add mtgto/maildown#npmize して動作を確認しました)。

const convert = require("maildown");
const markdown = `
# ここにMarkdownを書く
`;
console.log(convert(markdown));

以上、よろしくお願い致します。


var textlint = require("textlint").textlint;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PRの説明にも書きましたが、この方法では @textlint/linter-formatter の初期化時に非Node環境でエラーが出てしまうため書き換えました。

@@ -2,7 +2,7 @@
"name": "maildown",
"version": "1.2.0",
"description": "",
"main": "index.js",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index.jsには document などブラウザーでしか動作しないものが含まれているため、ライブラリのメインとしては lib/convert.js を指定しました。

},
"dependencies": {
"textlint": "7.4.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npmパッケージとしてconvert実行に必要なライブラリをdependenciesに移動しました。

@@ -114,32 +114,32 @@ function convert(input) {
case Syntax.Code:
break;

case "table":
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Requestを投げてからindex.htmlを見直したところ、テーブルが変換できてなかったため修正いたしました。
https://github.com/textlint/textlint/blob/master/packages/%40textlint/markdown-to-ast/src/mapping/markdown-syntax-map.js

@hashrock hashrock merged commit 1568980 into anydown:master Jul 21, 2018
@hashrock
Copy link
Contributor

毎々お世話になっております。hashrockです。
弊社製品のmaildownをご愛顧いただきありがとうございます。

PR確認させていただき、反映させていただきました。
npm化の対応、素晴らしいですね!
npmへのリリースに関しては弊社法務部の顔色を伺う必要がございますので、
少々時間がかかってしまうかもしれませんが、お待ちいただけますと幸いです。

以上、何卒宜しくお願い致します。

@mtgto
Copy link
Contributor Author

mtgto commented Jul 21, 2018

いつもお世話になっております。

この度は急なPull Requestにもかかわらず早急にマージしていただき、
心よりお礼申し上げます。

npmへのリリースについてはお忙しいところ恐縮ですが、
前向きにご検討いただけましたら幸いです。
Pull Requestの説明にも書きましたが、GitHub上のタグ、ブランチなどをnpmとみなして、
yarn add anydown/maildown#master のように利用することも可能であるため
取り急ぎライブラリとして利用できる状態にはすでになっております。
詳細はこちらの説明をご覧ください。 https://docs.npmjs.com/files/package.json#github-urls

以上、よろしくお願いいたします。

@mtgto mtgto deleted the npmize branch July 21, 2018 12:51
@hashrock
Copy link
Contributor

@mtgto

いろいろ解説いただきありがとうございます!おかげで弊法務部もニッコリでした。
先程、@anydown/maildownにpublishさせていただきました。
利用上お困りの点などございましたらご連絡いただけますと幸いです。

以上、何卒宜しくお願いします。

@mtgto
Copy link
Contributor Author

mtgto commented Jul 22, 2018

日頃より、格別のお引き立てを賜り、ありがとうございます。
このたびは、ご多忙中にもかかわらずnpmへのpublishしていただきまして、
身に余る光栄と心から感謝しております。

@hashrock 様のますますのご発展をお祈り申し上げます。

取り急ぎ、お礼まで申し上げます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants