From 58b8e5bb8abcd66e0c8b565bc27886bbf1f29223 Mon Sep 17 00:00:00 2001 From: AlexxNB Date: Fri, 17 Apr 2020 23:57:00 +0300 Subject: [PATCH] add table of contents --- README.md | 96 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 54 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 1f3a436..2eb1c99 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,19 @@ The tinro is highly declarative, very tiny ([~3.5 Kb](https://github.com/AlexxNB * Routes with parameters (`/hello/:name`) * Redirects * Fallbacks on any nested level -* Parsing query parameters (`?x=42&hello=world`) +* Parsing query parameters (`?x=42&hello=world&fruits=apple,banana,orange`) + +## Documentation + +* [Install](#install) +* [Getting started](#getting-started) +* [Nesting](#nesting) +* [Links](#links) +* [Redirects](#redirects) +* [Fallbacks](#fallbacks) +* [Parameters](#parameters) +* [API](#api) + ## Install @@ -96,7 +108,47 @@ Books list: ## Links -There no special component for make links which router can serve. Use native `` elements. When the `href` attribute starts with single `/` sign (like `/mypage` or just `/`), it will be treated as internal link. Other cases does not affect on links behavior. +There no special component for links. Just use native `` elements. When the `href` attribute starts with single `/` sign (like `/mypage` or just `/`), it will be treated as internal link. Other cases does not affect on links behavior. + +## Redirects + +You can redrect browser on any path using `redirect` property: + +```html + + + + + +``` + +## Fallbacks + +The routes with `fallback` property shows their content when no matched address where found. Fallbacks may be placed inside non-exact `` only. Fallbacks are bubbling, so if there no fallback on current level, router will try to find fallback on any parent levels. See the example: + +```html + + Root page + Page + + Subpage1 + + + Subpage2 + No subpage found + + No page found + + +... +... +... +... +... +... +... +... +``` ## Parameters @@ -155,46 +207,6 @@ There are two ways to get parameters in nested component: ``` -## Redirects - -You can redrect browser on any path using `redirect` property: - -```html - - - - - -``` - -## Fallbacks - -The routes with `fallback` property shows their content when no matched address where found. Fallbacks may be placed inside non-exact `` only. Fallbacks are bubbling, so if there no fallback on current level, router will try to find fallback on any parent levels. See the example: - -```html - - Root page - Page - - Subpage1 - - - Subpage2 - No subpage found - - No page found - - -... -... -... -... -... -... -... -... -``` - ## API You can import `router` object from the `tinro` package: