landf/epubmarkdown

Just a little help for them. This is a Markdown dialect optimized for EPUB 3.

1.4.6 2023-05-17 18:50 UTC

README

by Densho Channel
https://denshochan.com/


Illustration (c) JCN Inc. & Garakuta.

based on:

PHP Markdown Lib by Michel Fortin
http://michelf.ca/

Markdown by John Gruber
http://daringfireball.net/

Features

This library is implementing some features that make writing EPUB content documents easier.

  • GFM style line break
  • Block titles(bridgehead) [deprecated]
  • Global Language Support
    • Japanese Ruby Annotation
    • Tate-Chu-Yoko
  • Twitter account autolink syntax
  • Footnotes with epub:type attribute
  • EPUB pagebreak syntax
  • Chunk file syntax

Requirement

This library package requires PHP 5.5 or later.

Before PHP 5.5, pcre.backtrack_limit defaults to 100 000, which is too small in many situations. You might need to set it to higher values. Later PHP releases defaults to 1 000 000, which is usually fine.

This library also requires Composer to use dependent library PHP Markdown Extra. Before using this library, install Composer and execute composer install.

Usage

$parser = new Denshoch\DenDenMarkdown;
$parser->tarnsform('Hello wolrd!');
// => <p>Hello wolrd!</p>

options

You can pass Harusame options which automatically add special classes for Tate-Chu-Yoko and text orientation in vertical writing mode. It is disabled by default.

$options = array("autoTcyDigit" => 3, "autoTextOrientation" => true);
$parser = new Denshoch\DenDenMarkdown($options);
$parser.transform('10円玉と100円玉がある♡');
// => <p><span class="tcy">10</span>円玉と<span class="tcy">100</span>円玉がある<span class="upright">♡</span></p>
key type inital description
autoTcyDigit integer 0 max digits of number to add .tcy class.
autoTextOrientation boolean false Add .upright and .sideways class or not.

Syntax

Description of EPUB Markdown syntax is available on https://conv.denshochan.com/markdown. Sorry, currently Japanese version only.

Thanks

  • Thanks to Makoto Kitaichi for supporting.

Copyright and License

DenDenMarkdown
Copyright (c) 2013 Densho Channel
http://densho.hatenablog.com/
All rights reserved.

based on:

PHP Markdown Lib Copyright (c) 2004-2013 Michel Fortin
http://michelf.ca/
All rights reserved.

Markdown
Copyright (c) 2003-2005 John Gruber http://daringfireball.net/ All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name "Markdown" nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

This software is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.