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

markdownserver

v2.2.3

Published

Simple markdown server with code syntax highlighting

Downloads

41

Readme

Markdown Server

Build Status Coverage Status

A simple HTTP server that serves markdown files.

Supported Syntax

If you find any issues, please report them in the issues section of this repo.

Installation

Install dependencies, build, then start the development server with gulp.

git clone https://github.com/superzadeh/MarkdownServer
cd MarkdownServer
npm install gulp -g
npm install
gulp build
gulp

Drop files in the ./markdown folder, and access them by file name without the extension.

If you need to serve images, you can drop them in the public/images folder. To reference them in a markdown document, simply use images/your_image.png as source.

http://localhost:3337/example

Gulp tasks

The following gulp tasks are available:

| Task name | Description | |-------------------|-------------| | gulp | run the serve task | | gulp serve | starts serving using browser sync and watches for views/markdown changes | | gulp build | builds semantic UI and deploys dependencies to the public/dist folder | | gulp build-serve | runs build and serve |

The serve task (which is also the default gulp task) will start nodemon to automatically restart the server if server code changes, as well as browsersync to refresh if the views or markdown files are updated. This means that you can also use this as a live previewer of your markdown files.

Hosting on IIS

This server comes with a preconfigured web.config file as well as an issnode.yml. To host this site in IIS:

  • Clone/copy the content of this repo in a IIS WebSite.
  • Install iisnode
  • Make sure you application's pool identity has read/write permissions to the site's folder
  • The application pool can be in .NET 2 and does not need to enable 32 bits applications
  • Run npm install to install dependencies
  • Customize the default web.config (enable authentication, etc.)
  • Customize the default issnode.yml file (disable dev errors, etc.)

Configuration

Local files

By default, all files within the folder ./markdown will be served. This folder can be changed by setting the environment variable MARKDOWN_FOLDER.

External files

To load files from an external URL, set the following environment variable:

  • MARKDOWN_EXTERNAL_ROOT

You can then access the files using http://localhost:3337/external/filename, where the file loaded will be located at MARKDOWN_EXTERNAL_ROOT/filename.md. Example:

  • If MARKDOWN_EXTERNAL_ROOT is http://google.com/, then http://localhost:3337/external/filename will load the file at the url http://google.com/filename.md.

Note that for IIS hosting, environment variables can be set using appSettings in the webconfig where the key is the name of the environment variable and the value is its value.

Authentication

URL requests for external files can use NTLM authentication. To do so, set the NTLM_DOMAIN environment variables and run the command line tool provided with markdown server to set the username and password that should be used for the NTLM authentication. These credentials will be encrypted and stored in a credentials.json file at the root of the server:

npm install markdownserver -g
markdownserver -u username -p password

Contributions

Pull requests are welcome, as long you keep this thing simple. I want it to be and remain a very simple solution to serve markdown files.

Running tests

You can run tests using npm test. To run the tests as well as a coverage analysis, use npm run test-cover. There is also a watchable task npm run test-watch.

Note that the coverage threshold is at 90%, so make sure your stay above it if you make changes.

TODO

  • [X] Implement NTLM tests
  • [X] Add bluebird and promisify all the things
  • [X] Improve the sidebar: make it collapsible and make the content good looking
  • [X] Expose the table of content of a local file through a JSON API
  • [X] Expose the table of content of an external file through a JSON API
  • [ ] Add a search feature
  • [ ] Create a review workflow with ability to add comments
  • [ ] Add FTP support
  • [ ] Add an administration UI (or CLI client) to setup NTLM, External & FTP parameters, as well as select the default highlighter theme
  • [X] Provide a more secure way to store credentials (still not ideal, provide a proxy based solution for auth)
  • [ ] Allow users to upload new markdown files
  • [ ] Tune performances
  • [ ] Reorganize mocks and nocks to make them easier to reuse/maintain

Visual Studio Code

This project is optimized for edition within Visual Studio Code. make sure to run tsd install to retrieve all the typings. This will provide you with Intellisense for the frameworks used in this project.

npm install tsd -g
tsd install

I also recommend to use the Beautify extension that will help ensure the same coding style automatically (beautify on save is enabled).