Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

petersamokhin/nodejs-markdown-site

Repository files navigation

Markdown Site Engine

js-standard-style contributions welcome made-with-Markdown Ask Me Anything ! GitHub license

Make your project documentation (or blog, or something else) with Markdown.

Features

  • HTML-generating on-the-fly from the Markdown files.
  • Generating of navigation on-the-fly.
  • Dynamic permissions management:
    • Each user has a list of roles (roles are like GitHub's organization's groups).
    • Each page and directory should have a list of roles.
    • User can see the page (in navigation too) if he has at least one role from page's list.
  • Search on all pages depending on access rights of current user.
  • Preview of result html page in creating page.
  • All settings and access rights are fully configurable (using admin panel or changing the code).
  • Too easy to add new setting — admin panel is generated too. You simply need to add new setting and default value, and then you will be able to configure it in admin panel.
  • You can simply copy your markdown files to views/pages/ and (if it necessary) manage access to paths — and then your documentation is ready :) All new pages and directories will be indexed at next page loading.
  • Nice looking & adaptive design for all screen sizes.
  • Other small but useful features:
    • Each header has #link to it
    • Most code snippets will have copy button on header above
    • You can use all kramdown features
    • Main pages folder from configuration will be always on top in navigation on each page.
    • Pages will have default access rights from config and will be placed in Main pages folder if you wont specify path or roles.
    • Advanced error handling (page with information about error will be shown for each error, so no crashes must occur)

Sample

This readme page after rendering:

And mobile version (iPhone 8 Plus):

Requirements

Install

Any *NIX OS is supported. No guarantees for Windows.

  1. Make some directory for installing mongodb from docker:
cd ~
mkdir mongodocker
cd mongodocker
  1. Copy necessary files from mongo-docker repository:
export MONGODB_VERSION=4.0
curl -O --remote-name-all https://raw.githubusercontent.com/docker-library/mongo/master/$MONGODB_VERSION/{Dockerfile,docker-entrypoint.sh}
export DOCKER_USERNAME=username
chmod 755 ./docker-entrypoint.sh
  1. Create docker-compose.yml in your directory with following content:
version: '2'

services:
  mymongo:
    image: mymongo
    container_name: mymongo
    restart: always
    build:
      context: .
      dockerfile: ./Dockerfile
    ports: ["27017:27017"]
    volumes:
      - '/etc/mongod.conf:/etc/mongod.conf'
    command:
      - '--config'
      - '/etc/mongod.conf'
    networks:
      mongo_net:
        ipv4_address: 172.22.0.2

networks:
  mongo_net:
    driver: bridge
    ipam:
      config:
      - subnet: 172.22.0.2/24
        gateway: 172.22.0.254

Where 172.22.0.2 is public IP for accessing database. You can change it.

  1. Create /etc/mongod.conf with following content:
storage:
  dbPath: /data/db
  journal:
    enabled: true

net:
  port: 27017
  bindIp: 127.0.0.1,172.22.0.2 # here you can see this IP again
  1. Start mongo in background:
docker-compose up -d
  1. Clone this repo. I'm not gonna to upload project to npm, etc.
git clone https://github.com/petersamokhin/markdown-site
  1. See started networks and find mongodb network's name:
docker network ls

You must see something like this:

NETWORK ID          NAME                           DRIVER              SCOPE
a117428b09c9        bridge                         bridge              local
0b75179024f0        host                           host                local
b1c67fcbca63        mongo-docker_mongo_net         bridge              local
df7d198ae6c2        none                           null                local

Find network with name like mongo-docker_mongo_net. It can be literally mongo-docker_mongo_net.

  1. Change the name of a mongo network at the end of this project's docker-compose.yml. Now it's mongo-docker_mongo_net.

  2. Start project in the background:

docker-compose up -d

Additional info

You can use local MongoDB which is not in docker container, in this case, you must do it by yourself.

Profit!

3rd party

License

MIT
Copyright (c) 2018 PeterSamokhin
https://petersamokhin.com/