Socket
Socket
Sign inDemoInstall

slack-log2md

Package Overview
Dependencies
2
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    slack-log2md

Slack log file (JSON) to Markdown.


Version published
Maintainers
1
Install size
6.34 MB
Created

Changelog

Source

v1.5.0

Changes

  • Omit the ./ at the beginning of the relative path #36

Readme

Source

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:

ParameterTypeDefaultDescription
srcStringDirectory path of log file exported from Slack.
destStringDirectory path to output Markdown file converted from log. If a nonexistent directory is specified, the same location as input is selected.
optionsOptions{}

Options:

ParameterTypeDefaultDescription
reportBooleanfalsetrue to display the processing status of the tool to stdout.
groupingSameDayByUTCBooleanfalsetrue if messages in the channel are grouped by the same day in UTC. If false, the group is the output log file unit.
githubWikiBooleanfalsetrue 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.
addUniqueMessageIdBooleanfalseAdd unique identifier for a message. Set the time in the Time field to <span id ="XXXX">21:34</span>.
ignore.channelLoginBooleanfalseSpecifies 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

Keywords

FAQs

Last updated on 07 Feb 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc