MdCollab

Collaborative editing and previewing of Markdown files

Backend

Implementation in Rust following MarkdownComposer which uses aurelius

Building

For compiling the rust code into wasm we use wasm-pack:

cargo install wasm-pack  # only once
wasm-pack build

It deploys the WebAssembly code to pkg/.

Everything website specific is under site/. To automatically build the site, use npm:

cd site/
npm install  # only once
npm run serve

Contributing

CI

The CI uses stylelint to lint css and html files. Furthermore html files are linted with htmllint-cli. Linting javascript files is done with eslint. Furthermore a dependency check for javascript is done with npm-check and webpack tries to build the sourcecode. The rust code is linted with clippy. Rust unit tests are done with cargo test.

The following sections describes how to install and run this tool, to check local if the ci will pass.

stylelint

Since stylelint is part of devDependencies in package.json you can install stylelint inside the site directory with npm install.

To run stylelint use the following commands:

# To lint html files
npx stylelint --config ./lint/.stylelintrc.json "**/*.html"

# To lint css files
npx stylelint --config ./lint/.stylelintrc.json "**/*.css"

⚠️ Note that you have to run these commands inside the site directory as well.

htmllint

The first step is to install htmllint. You can do that with the following command:

sudo npm install -g htmllint-cli

After that you can run htmllint like this to lint your html files:

htmllint --rc ./lint/.htmllintrc **/*.html

⚠️ Note if you do not run this command inside the site directory you have to modify the path which refers to .htmllintrc

eslint

As stylelint eslint is part of the devDependencies in the file package.json. That means that you can install it inside the site directory with npm install.

To lint your javascript code run the following command:

npx eslint -c ./lint/.eslintrc.js "**/*.js"

⚠️ You should run this command inside the site directory to avoid any errors .eslintrc.js

npm-check

Run the following command to install npm check:

npm install -g npm-check

To run dependency checks use the npm-check command.

build javascript

To build java script without starting the server use npm build inside the site directory. You have to install the node.js modules before. Use npm install inside the site directory for that.

clippy

First step to use clippy is to install it. You can install clippy using the following commands:

rustup component add clippy

To lint your rust files use:

cargo clippy --all-targets --all-features -- -D warnings

rust unit test

To be complete, here are the instructions to run rust unit tests:

cargo test