This document is aimed at document writers who intend to write online documentation for various systems. It is advised to use html editing tools that does not create unnecessary code like SharePoint Designer to edit so you get clean html.
The page is divided into multiple sections: [[top-nav]], [[left-nav]], [[main content]] and [[footer]].
Some of the content pieces are driven from external files to keep design and structure consistent while other sections specific to the page can be updated by editing html of this page itself.
The web page is build using w3css which is a light weight version of bootstrap designed by Google. Unlike bootstrap it does not have fancy animations as it does not have a js library but only css. That also means that the page is fast to load and by adding a few simple javascript functions it's functionality can be enhanced. W3css link can be found on footer section of this page for further study.
The benefit of using w3css is to provide mobile first experience to users. The document is responsive and adjusts to all screen sizes to make the page user-friendly.
In addition to it the page also use font-awesome and google fonts to provide nicer user experience.
The web page is printable and automatically hides certain sections that need not be displayed printed on paper or pdf. It also sets up a cover page to give neat printed document. Go ahead and try print preview this web page to see the difference.
Note some links have a javascript functions that when printed will not be of much use to reader. You can skip printing urls of those links by adding class skipPrint
to them.
As a first time user, you will be asked to enter your name so the document knows you when you open it next time. The username is stored in document cookies globally; meaning it can be shared across all documentation. Please note that the cookies are machine and browser specific, which means if you use another machine or switch your browser between IE, Edge etc, you will be asked to enter username again.
The aim of top-nav is to provide consistent set of links to all users. The contents of top-nav are stored in [[Documentation/Assets/commonHtml.js]]
The top-nav will adjust to different screen sizes. For desktop top-nav will have a pair of icon and text for each link. For small screens, it will only show icons.
The first icon on left [book icon] is for going to top of page. On right side of the bar you will see user icon with name next to it. Name will hide on small screen and will be replaced with three bar icon for left-nav.
Middle section of the top-nav has all the useful links including Theme and Help.
Theme allow users to customise colour scheme for themselves. This personalised scheme also uses document cookies stored globally which means it will be available for all their documents on same machine and browser. There are 23 colour swatches which when clicked will change the theme. First one is blank to clear any customised theme. Note when you open the web page after clearing theme or refresh the page, it will reset to blue theme by default.
Theme automatically changes all the coloured content including top-nav, left menu, headings, footer etc. These themes are provided as is by Google w3css. So to be able to use these themes, icons and some fonts, you must be online.
Some themes may not be fully accessible so users are advised to use the theme that best suits their needs.
A help popup is a small paragraph, essentially a summary of this document that appears on every page. Like top-nav, contents of this popup are also derived from one file. The popup drops down on mouse over on desktop and a tap is required on mobile devices.
The popup is within same browser window so there is no blockage of popup. It also adjusts to screen sizes. For desktop full page view, it will be horizontally aligned and for mobile view it will be vertically aligned with a scrollbar.
Left-nav is auto generated from heading 2 tags.
Left-nav is available by default on desktop full screen view. The navigation allows users to navigate to page content easily. On smaller screens, the navigation is hidden and a three bars button appears on top right corner of top-nav. This button when clicked slides left-nav from left side of the screen and can be closed by clicking on cross icon on the left-nav. The navigation is not available on printed documents as well.
Left-nav popup.
Main content consists of editable sections. Each section has headings and paragraphs on left side accompanied by an image on right, if required.
A section is enclosed in div of type row. class="w3-row w3-padding-64"
Each row has multiple container divs. Each div can have a combination of headings and paragraphs. If a section has a set of images like this one, use class="w3-twothird w3-container"
for text and another div after it to hold images class="w3-third w3-container"
<div class="w3-row w3-padding-64"> <div class="w3-twothird w3-container"> container for content... </div> <div class="w3-third w3-container"> container for images on left... </div> </div>
Images are on right hand side of the main content. Images are auto clickable and open up in a dialog box to fill the screen. This does mean that image needs to be added with class="thumbnail"
to work. Click on the image in this section to see the effect. Once dialog box is open, it can be closed by clicking on cross on top right corner or if you are on PC you can use Esc
key.
Heading 2 is used at the beginning of every section. A section heading is picked up on left-nav automatically. Links on left-nav are clickable and they take you to the beginning of appropriate section.
Use style below for a H2 tag to ensure it has consistent look and feel and is picked up in left-nav. Use id
and title
properties of H2 tag to give useful titles as these properties are used to generate left-nav.
<h2 id="unique-alphanumeric-id" title="Text to show on left-nav" class="w3-theme-l5 w3-text-theme w3-padding"> Heading 2 </h2>
You can also use sub headings like h3, h4 and so on for further sub dividing your section but they do not appear on left-nav.
Use class="w3-text-theme"
for h3 tags. H4 tags need not have any style.
The content will appear differently depending on screen size. For smaller screens like mobile, image sections will push down to fill in whole screen width.
Footer tag allows users to personalise the page and hence is part of the page and not derived from external file like top-nav. Here you can add a brief summary, some links and page details.
Example popup on image click. Responsive view of page on small screen.
Example code for page section.
You can use some of these code snippets to construct documentation.
Code tile lets you add code as is to your html document. The code must be wrapped in pre
tag. This tag allows you to add your code in multiple lines and retains spacing. Within pre tag add a styled div container where you can simply copy and paste your code just like the example below.
//----------------------------------- //SP2016 top bar user image. function getUserImage(){ //Get image of current user and add to the top nav. var imgUrl = MYSITEImgURL + "User%20Photos/Profile%20Pictures/[userid]_LThumb.jpg"; var u = _spPageContextInfo.userLoginName; var userid = u.split("\\")[1]; imgUrl = imgUrl.replace("[userid]",userid); return imgUrl; }
The code tile however does not display html tags rather it renders it into the html page. To show html tags you have to escape html first and then add it to the above panel. An easier alternative is to use a textarea wrapper around your code. The textarea below contains the html code for above snippet which is read only but users can copy the code.
Short code is a short hand for [[wrapping some text in a code bubble]]. Just use double square brackets [ [ some text ] ] and text will be automatically wrapped. Ensure there is no space between a pair of square brackets. Also do not enter just one set of brackets like left square bracket only. Double left bracket should end with double right bracket or the code may break the page.
Files list allows you to add files to your documentation quickly. The list below shows file icons and their relative path.
File icons are auto generated based on file extension [[.js]] in title property of a span with [[w3-bar-item]] class.
Folder list item automatically take different colour scheme. You can use sub-item arrow [[↳]] to show hierarchy of items. Mouse over the file name text to show file path.
Adding [[span class="panel"]] will automatically add a drop down [[]] to the list item. You can add description of the item to this panel.
The code below shows how the list is added on the page. You will notice that there is minimal code to show the list. All the icons and drop down features are added to the list using script which keeps the html page code clean.
Easily add font awesome icons to your document by adding following code. For font awesome to work, you need to reference required css in head section of a html page. Font awesome is already being referenced in your document and all you need is correct class for the icon tag. Check out the font awesome site for references to icons. Note: examples on the site uses <i></i>
tags which could be a compliance issue. Using <span></span>
tag is a safer option and works just fine.
A standard icon a large icon and an icon with current theme
It is also possible to save a piece of information once and use it multiple times in various documents; allowing you to maintain it at one place. The information is saved in a [[commonHtml.js]] file in [[Documentation/Assets]] folder. Adding it to a javascript file makes it available throught the documentation and permission issues to load files dynamically are avoided when documentation is on local machine.
Note html formatting is preserved for readibility by adding [[\]] backslash character in javascript string. This allows html to be split to multiple lines without breaking javascript code. You can achieve the same using concat function.
Once the piece of information has been created in commonHtml file, it can be referenced in documentation by adding an element e.g. [[div class="modal loadCommonHtml" id="myModal"]]. The id of element must match javascript variable with 'Html' added to the variable [[id="myModal" ... var myModalHtml = '...';]]