npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ordinance-format-jp

v1.0.2

Published

generate legal doc HTML from markdown text

Downloads

5

Readme

公文書、規則メーカー

公文書や規則用の目的で記載したMarkdown形式のテキストを、公文書のスタイルの整ったHTMLに変換します。

サンプル文書

デモページ

サンプル

インストール

npm install -g ordinance-format-jp

使い方

標準出力にHTMLを出力する場合

ordinance-format-jp <markdown file>

ブラウザで使用する場合

import { format } from 'ordinance-format-jp'

const formatedText = format(<markdownText to format>, { standalone: true, elementId: 'corp-site-pp'})

'formatedText'に、整形され、さらにstyleの当てられているHTMLが出力されます。

JavaScript API

const ordinanceFormatJp = require('ordinance-format-jp')
const markdownText = require('fs').readFileSync('/path/to/somefile.md', 'utf8')
const html = ordinanceFormatJp(markdownText, { standalone: true, elementId: 'foo-bar' }) // rendered html

オプション

  • --nostyle: styleタグをつけず、HTML構造のみ出力します。
  • --elementId <elementId>: トップレベルのdivタグのid名です。

Markdownの記載ルール

  • 文書のタイトル #
  • 前文
    • タイトルの後に書かれた文章はそのままの文章で出力されます。
# 文書タイトル
ここには、序文のような説明文が入ります。 ここには、序文のような説明文が入ります。 ここには、序文のような説明文が入ります。 ここには、序文のような説明文が入ります。
  • ##
    • 項が1つである場合、順番はつきません。
    • 複数存在する場合は、各項の先頭に 数字. と記述すると上から順に項番がふられます。
    • 1行改行した場合も番号がふられ出力されます。
    • -では出力されず、数字でのリスト構造のみ出力可能です。
    • 数字でのリスト構造を用いる場合は改行をしないでください。
    • 入れ子にすることにより、より項の中に項が入れ子に出力出来ます。
## 条と項というのがある
項以下には、小項目を追加できます。
  24. こうすれば項の下の小項目です
  5. もちろん複数いけます
    1. そう、二段階いけます
      1. まさかの三段階いけます。
      1. いまのところ三段階まで。
      1. 項を含めると四段階までと考えてもいいですね。
  • ラベルと参照
    • ラベルと参照機能は、各条項の頭にラベルとしてキーを設定し、同じキーを各条項の文中に用いることで参照することができる機能です。
    • ラベル、参照いずれも `someKey` で利用できますが、文頭で参照したい場合は必ず `$someKey` のようにキーの頭に $ をつけてください。
## `ラベル名` ラベルがつけられた条
ラベルをつけると、その条の名前をどこからでも参照することができるようになります。

ラベルは、文またはタイトルの先頭にバッククオートで任意の文字列を囲むことでつけられます。

## ラベルをつかってみましょう。
例えばここでラベル名をいれてみます ラベルがつけられた条は => `ラベル名`です。

小項目にもラベルをつけられる。
  1. せっかくなので、多段階にしてからそれを実感してみましょう。
    1. まだまだ。
      1. `小項目のラベル` さて、この小項目にラベルをつけました。

## 小項目のラベルを参照してみます
さきほどの小項目は、`$小項目のラベル` にありましたね。
  • 補足情報
    • 住所や電話番号など補足情報として出力出来ます。
  • タイムスタンプ
    • 以下の例のように書くことによって、ユーザーが指定したタイムスタンプを出力出来ます。
     ``` Date ```
  • 他のリンクや強調、インライン表現などはMarkdownと同じように利用出来ます。
## ちょっとしたテクニック
[リンク](https://github.com/CureApp/ordinance-format-jp)、**強調**といったインライン表現は、
Markdownと同じようにつけることができます。

住所や電話番号といった補足情報を入れることができます。
> 補足情報です。
> ちょっとインデントが加わるので、補足情報を書くのにいいです。

```
作成日: 2017年7月23日
変更日: 2017年7月23日
```

Contibution

  1. Forkする
  2. あなたの考えていることをIssueに立てる
  3. あなたの考える機能を実装するブランチを作る
  4. 変更をコミットする
  5. あなたの実装したブランチをPushする
  6. Pull Requestを送る

LICENSE

Apache-2.0