Skip to content

Conversation

@satoryu
Copy link
Member

@satoryu satoryu commented May 14, 2025

commonmarker has changed its API since v1.0.0
render_html is now deprecated and the new to_html method is recommended.

Changes in this PR

  • Replace a usage of CommonMarker#render_html with Commonmarker#to_html
  • Update expected HTML in specs to match the new API output

@Nyoho
Copy link
Member

Nyoho commented May 14, 2025

僕も最近commonmarkerでこけていることに気付いて https://github.com/Nyoho/tdiary-style-gfm/tree/conform-new-commonmarker で修正しながら実験していました。

これまでのオプションを反映するために extensionautolink: truetable: true が、renderunsafe: true が必要だと思います。

Nyoho@3ffae78

これで unsafe が使えるのかと思ったら、これでもなお <iframe><script> がエスケープされるようでしたので、元の UNSAFE を反映するために extensiontagfilter: false を付ける必要がありそうでした。

(ここまで調べたところで止まっています)

@Nyoho
Copy link
Member

Nyoho commented May 14, 2025

Just a small correction — CommonMarker#to_html should be Commonmarker#to_html with a small M.

@hsbt
Copy link
Member

hsbt commented May 14, 2025

Thanks!

I will migrate Travis to GitHub Actions at next week. Could you wait until that migration?

@satoryu
Copy link
Member Author

satoryu commented May 14, 2025

@Nyoho コメントありがとうございます。
オプションについてはCommonmarkerのデフォルト値でこれまでのこのgemの挙動をサポートできそうと思っています。
gjtorikian/commonmarker: Ruby wrapper for the comrak (CommonMark parser) Rust crate
iframescriptについては挙動を確認してなかったので、あとで試してみます。ありがとうございます。

@satoryu
Copy link
Member Author

satoryu commented May 14, 2025

@hsbt yes, I can wait.

@Nyoho
Copy link
Member

Nyoho commented May 14, 2025

(((Plus, just a super small correction — "an usage" should be "a usage")))

@Nyoho
Copy link
Member

Nyoho commented May 14, 2025

本当ですね! デフォルト値のリンク、ありがとうございます。

<script> などについては #26 のときに対応しました。(:UNSAFE がその名残です)

@Nyoho
Copy link
Member

Nyoho commented May 14, 2025

それから現バージョンだと、なぜかエラーで止まるのではなくてGFMを使っている.td2ファイルだけがごっそり消えるという怪現象が起こります。

@satoryu
Copy link
Member Author

satoryu commented May 14, 2025

@Nyoho 無学なので教えていただきたいのですが、 .td2ファイルとは何でしょうか?

@Nyoho
Copy link
Member

Nyoho commented May 14, 2025

@satoryu tDiaryで日記を書いたときに保存される、拡張子td2で作られるファイルです。月ごとに1つずつ作られます。

まだ、どの組み合わせで再現するのか特定できていないのですが、僕の本番環境でGFMの.td2ファイルがごっそり消えて、昔のWiki形式のファイルだけが残っていました。(しばらくbundle updateしていなかったところで最近bundle updateして、rubyも3.4にしたら起こりました。)

@hsbt
Copy link
Member

hsbt commented May 20, 2025

@satoryu I've done to migrate to GitHub Actions.

I found commonmarker 2.0 break CommonMarker namespace. We should add extra changes for that.

@satoryu
Copy link
Member Author

satoryu commented May 29, 2025

I found commonmarker 2.0 break CommonMarker namespace.

Yes, this PR addresses that break (see here).

Also, the migration to GitHub Actions helped uncover another issue: a dependency problem when running tests on Ruby 2.7.

We might consider dropping support for Ruby 2.7 and stop running tests on Ruby 2.7 in GitHub Actions.
What do you think about this approach?

@hsbt
Copy link
Member

hsbt commented May 30, 2025

It seems only requirement version issue of RubyGems. Could you try with gem update --system?

satoryu added 2 commits May 31, 2025 00:09
the latest version 3.6.9 of rubygems requires ruby 3.1 or later.
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.

3 participants