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

minarai-markup-notation

v1.1.0

Published

Small markup language to annotate meta information

Downloads

3

Readme

minarai-markup-notation

ボット発話にメタデータを付与するための記法。これをフロント側で解析して表示とかに利用するためのもの。

インストール方法

これから。

使用方法

import {parse, render} from 'minarai-markup-notation';

const sexp = parse("お電話はこちらまで!\n#.tel[0120444444]\nなお営業時間は…");
console.log(sexp);
;; => ["お電話はこちらまで!\n", ["tel", "0120444444"], "\nなお営業時間は…"]

console.log(render(sexp));
;; => お電話はこちらまで!
;;    <a href="tel:0120444444">0120444444</a>
;;    なお営業時間は…

また、レンダラーをカスタムすることが可能。

仕様

設計の経緯

  • 元issue: https://github.com/Nextremer/minarai-project/issues/695
    • 電話番号が電話番号であることをシナリオ(のボット発話)中で表記/明記したい
  • 将来、電話番号以外もマークアップしたくなるかもしれない
    • →名前による種類の明記 (tel など)
  • マークアップ記法をちょっと汎用に設計しておくのがよいかも(実装はしなくていいが)

設計思想

  • 始まり、終わりがはっきり分かれている
  • 名前 (マークアップの意味を識別するためのもの)をもつ
  • 以下の機能は、実装の必要はないが可能性がゼロではないので設計だけしておく
    • 複数パラメータ
      • ひとつのパラメータで挙動を決定できないマークアップ
      • #.location[Nextremer東京Office;緯度;経度]のようなかんじ
      • 表示について (文字の大きさ、色など) は<span>タグ記法が使えるのでやらない
    • マークアップの中にマークアップ
      • #.address[電話:#.tel[0123-45-67]、住所:#.location[Nextremer;緯度;経度]]
      • 通常はこんなことしたいと思わないだろうが、いちおう

仕様

電話番号についてのマークアップはこんな感じ

ご用の際はお気軽に、こちらにお電話ください: #.tel[0120-444-444]

マークアップの始まりは#.

あまり文字数を多くしたくないが、#だけだと以下のようなふつうの文章がマークアップだと認識される。

フォーラムの#124を参照してください(なお、即日対応できる保証はありません)。

#.はふつうの文章にはでてこないでしょう、という仮定のもと。

名前はアルファベット小文字と数字のみ

プログラムが利用するので。

マークアップ対象は[]で囲む

CSChatのシナリオで使用可能な構文との統一感のために ([[文言1|文言2|...[[)、丸括弧ではなく角括弧とする。

マークアップ対象は空白なし?

空白を含めたかったら、'で囲んでこうするとか? いらないかも。

#.address[住所: 東京都]

マークアップ対象が複数ある場合は;で区切る (実装は必須でない)

ここで;の前後に空白を入れると、マークアップ対象の一部になる

#.location[Nextremer東京Office;緯度;経度]のようなかんじ

マークアップ対象の中にマークアップ記法があってもちゃんと処理する (実装は必須でない)

こんなやつを中身もマークアップとして扱う、という話。

住所はこちら!
#.address[電話:#.tel[0123-45-67]、住所:#.location[Nextremer;緯度;経度]]