KDP(電子出版)のメモ 急急如律令

Amazon Kindleダイレクト・パブリッシングでの電子出版や電子書籍の作成販売について、文章やイラストの作成や編集方法について書いています。

傍点と傍線をパース

HTML青空文庫変換で傍点と傍線をパースしたが、ブラウザで縦書きにすると、下線と傍線で表示が異なる。 text-decoration: underline; 縦書きだと右側に線 text-decoration: overline; 縦書きだと左側に線 EPUBだと表示が逆

tategaki.github.io

turndownの傍線と傍点の変換

rules.sesame = {
  filter: function (node, options) {
    return (
      node.nodeName === 'SPAN' &&
      node.getAttribute('class') === 'em-sesame'
    )
  },

  replacement: function (content, node, options) {
    return '[#傍点]'+ content + '[#傍点終わり]'
  }
}
rules.line = {
  filter: function (node, options) {
    return (
      node.nodeName === 'SPAN' &&
      node.getAttribute('class') === 'em-line'
    )
  },

  replacement: function (content, node, options) {
    return '[#傍線]'+ content + '[#傍線終わり]'
  }
}

1字下げ

1

github.com

HTMLから青空文庫への変換は様になってきたけど、青空文庫HTML変換がクラス指定が違うのが気になっている。

www.tiny.cloud

github.com