Skip to content

Instantly share code, notes, and snippets.

@zr-tex8r
Last active July 27, 2020 06:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zr-tex8r/176f80c099a21f54710e662e3ab1ed2f to your computer and use it in GitHub Desktop.
Save zr-tex8r/176f80c099a21f54710e662e3ab1ed2f to your computer and use it in GitHub Desktop.
Pandoc: 節番号はCSSで付ければいいんじゃないの
input-files:
- test.md
output-file: test_out.html
standalone: true
css: test.css
table-of-contents: true
toc-depth: 2
# avoid pandoc's numbering...
number-sections: false
body {
counter-reset: section, subsection;
}
.unnumbered {
counter-increment: none;
}
h1 {
counter-increment: section;
counter-reset: subsection;
}
h1.title {
counter-increment: none;
counter-reset: none;
}
h2 {
counter-increment: subsection;
}
.unnumbered::before, .title::before {
content: ""
}
h1::before {
content: "第" counter(section) "章 ";
}
h2::before {
content: "第" counter(subsection) "節 ";
}

まえがき {-}

ゆきだるま

ゆきだるまは素敵

ゆきだるまは本質的

TeXとの関係 {-}

マフラー

ホウキ

アヒル

アヒルは本質的か

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>test</title>
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
</style>
<link rel="stylesheet" href="test.css" />
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
</head>
<body>
<nav id="TOC" role="doc-toc">
<ul>
<li><a href="#まえがき">まえがき</a></li>
<li><a href="#ゆきだるま">ゆきだるま</a>
<ul>
<li><a href="#ゆきだるまは素敵">ゆきだるまは素敵</a></li>
<li><a href="#ゆきだるまは本質的">ゆきだるまは本質的</a></li>
<li><a href="#texとの関係">TeXとの関係</a></li>
<li><a href="#マフラー">マフラー</a></li>
<li><a href="#ホウキ">ホウキ</a></li>
</ul></li>
<li><a href="#アヒル">アヒル</a>
<ul>
<li><a href="#アヒルは本質的か">アヒルは本質的か</a></li>
</ul></li>
</ul>
</nav>
<h1 class="unnumbered" id="まえがき">まえがき</h1>
<h1 id="ゆきだるま">ゆきだるま</h1>
<h2 id="ゆきだるまは素敵">ゆきだるまは素敵</h2>
<h2 id="ゆきだるまは本質的">ゆきだるまは本質的</h2>
<h2 class="unnumbered" id="texとの関係">TeXとの関係</h2>
<h2 id="マフラー">マフラー</h2>
<h2 id="ホウキ">ホウキ</h2>
<h1 id="アヒル">アヒル</h1>
<h2 id="アヒルは本質的か">アヒルは本質的か</h2>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment