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

slack-log2md

v1.5.0

Published

Slack log file (JSON) to Markdown.

Downloads

22

Readme

slack-log2md

Support Node of LTS npm version test code style: prettier

Slack log file (JSON) to Markdown file.

Installation

$ npm install slack-log2md

Usage

Markdown file is generated from Slack log file JSON by running CLI or Node.js API.

Markdown

The generated Markdown file has the following format.

# 2019-10-31

|Time|Icon|Name|Message|
|---|---|---|---|
|13:43|![](https://example.com/test/72.png)|test|`@test` has joined the channel|
|07:02|![](https://example.com/test/72.png)|test|`@test` `#general` Sample message<br>Sample<br><br>Sample|
|07:02|![](https://example.com/bot/72.png)|Sample Bot|🇬🇧: Sample message.|
|15:22|![](https://example.com/test/72.png)|test|Quote: <br><blockquote>Sample<br>Text</blockquote>Please read the above.|
|18:09|![](https://example.com/test/72.png)|test|Code: <br><pre>const value = 'code';<br>console.log(value);</pre><br>Please read the above.|
|18:09|![](https://example.com/test/72.png)|test|Files.<br>https://example.com/files/sample.jpg<br>https://example.com/files/sample.md|
|18:09|![](https://example.com/test/72.png)|test|Sample.<br>Pre-text<blockquote>[sample/example] Text</blockquote><br><blockquote><!here> Text</blockquote>|
  • The message is output as a <table> tag.
  • If a profile image is set for the user, the URL is referenced and displayed.
  • The user will use the display name if there is one, otherwise it will be the account name.
  • The time is always UTC.
  • @user and #channel in the body text enclose the target name in <code> tags.
  • Emoji code (e.g. :smile:, :flag-gb:, ...etc) is converted to the corresponding Unicode character.
  • Convert line breaks \n to <br> tags.
  • Convert quotes (> text, &gt; text on log) to <blockquote> tags.
  • Convert code block to <pre> tags.

CLI

Usage:  slack-log2md [options]

Slack log file (JSON) to Markdown file.

Options:
  -i, --input <Path>          Directory path of the JSON file exported from Slack.
  -o, --output <Path>         Directory path to output Markdown file converted from JSON.
  -r, --report                Display the process reports, default is disable.
  --grouping-same-day-by-utc  Output Markdown grouped on the same day as UTC date.
  --github-wiki               Support output for GitHub Wiki. e.g. `general/2019-11-16.md` -> `slack-general-2019-11-16.md`
  --add-unique-message-id     Add unique identifier for a message. Set the time in the Time field to `<span id ="XXXX">21:34</span>`.
  --ignore-channel-login      Ignore channel login messages.
  -v, --version               output the version number
  -h, --help                  output usage information

Examples:
  $ slack-log2md -i ./logs -o ./dist -r

See also:
  https://github.com/akabekobeko/npm-slack-log2md

Node.js API

slackLog2Md(src, dest, options)

Converts Slack log JSON in the specified workspace directory to Markdown.

Parameters:

|Parameter|Type|Default|Description| |---|---|---|---| |src|String||Directory path of log file exported from Slack.| |dest|String||Directory path to output Markdown file converted from log. If a nonexistent directory is specified, the same location as input is selected.| |options|Options|{}||

Options:

|Parameter|Type|Default|Description| |---|---|---|---| |report|Boolean|false|true to display the processing status of the tool to stdout.| |groupingSameDayByUTC|Boolean|false|true if messages in the channel are grouped by the same day in UTC. If false, the group is the output log file unit.| |githubWiki|Boolean|false|true if support output for GitHub Wiki. Single directory, all file names are unique, avoid conflicts with existing page names. e.g. general/2019-11-16.md -> slack-general-2019-11-16.md.| |addUniqueMessageId|Boolean|false|Add unique identifier for a message. Set the time in the Time field to <span id ="XXXX">21:34</span>.| |ignore.channelLogin|Boolean|false|Specifies the type of message to ignore.|

Sample code:

const slackLog2Md = require('slack-log2md');

const options = {
  report: true,
  groupingSameDayByUTC: true,
  githubWiki: true,
  addUniqueMessageId: false,
  ignore: {
    channelLogin: true
  }
};

slackLog2Md('./logs', './dest', options).catch((err) => {
  console.error(err)
});

ChangeLog

License