Git Product home page Git Product logo

Comments (4)

inao avatar inao commented on July 20, 2024

Normalラベルを付けました。
対応は、以下のどちらかですね。

  • 段落分け機能をなくし、READMEから該当記述を削除する
  • 3段落目以降も段落分けされるようにしていただく(READMEどおりの挙動にしていただく)

from md2inao.

takahashim avatar takahashim commented on July 20, 2024

以下のpatchを適用すると、3段落目以降も段落されるようになります。

diff --git a/lib/Text/Md2Inao.pm b/lib/Text/Md2Inao.pm
index b4225d9..5223128 100644
--- a/lib/Text/Md2Inao.pm
+++ b/lib/Text/Md2Inao.pm
@@ -74,7 +74,9 @@ sub prepare_html_for_inao {
     $html =~ s!<li><p>(.+)</p></li>\n!<li>$1</li>\n!g;

     ## 段落切り替えの意図が見えるのにそうならないケースを補正 (issue #8)
-    $html =~ s!<p>(.*)\n !<p>$1</p>\n<p> !g;
+    while ($html =~ /<p>(.*)\n /) {
+        $html =~ s!<p>(.*)\n !<p>$1</p>\n<p> !g;
+    }
     return $html;
 }

ですが、例えば以下のような、途中で行頭の全角空白がない行が混ざったようなケースだと、そもそもどういう結果になるべきなのか直感的に分からないので、いっそ全角空白による段落分け機能をなくした方がスッキリするのではないでしょうか。

=== paragraph separation with fullwidth-space
--- in md2id
 テスト。
 テスト2。
 テスト3。
 テスト4。
テスト5。
 テスト6。
 テスト7。

 テスト8。
 テスト9。
--- expected
<SJIS-MAC>
<ParaStyle:本文> テスト。
<ParaStyle:本文> テスト2。
<ParaStyle:本文> テスト3。
<ParaStyle:本文> テスト4。テスト5。 テスト6。 テスト7。
<ParaStyle:本文> テスト8。
<ParaStyle:本文> テスト9。

from md2inao.

inao avatar inao commented on July 20, 2024

以下のpatchを適用すると、3段落目以降も段落されるようになります。

ありがとうございます!

いっそ全角空白による段落分け機能をなくした方がスッキリするのではないでしょうか。

おっしゃるとおりかと思います。
なくしていただけたりしますでしょうか…? 🙇

from md2inao.

inao avatar inao commented on July 20, 2024

@takahashim

すみません、コードをご提案くださっていたのを今気がつきました……。
ありがとうございました。

#149 で反映させたので閉じます。

from md2inao.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.