{"id":69495,"date":"2022-12-15T09:00:40","date_gmt":"2022-12-15T09:00:40","guid":{"rendered":"https:\/\/www.cryptocabaret.com\/?p=69495"},"modified":"2022-12-15T09:00:40","modified_gmt":"2022-12-15T09:00:40","slug":"improve-your-documentation-with-javascript","status":"publish","type":"post","link":"https:\/\/www.cryptocabaret.com\/?p=69495","title":{"rendered":"Improve your documentation with JavaScript"},"content":{"rendered":"<p><span class=\"field field--name-title field--type-string field--label-hidden\">Improve your documentation with JavaScript<\/span><br \/>\n<span class=\"field field--name-uid field--type-entity-reference field--label-hidden\"><a title=\"View user profile.\" href=\"https:\/\/opensource.com\/users\/jim-hall\" class=\"username\">Jim Hall<\/a><\/span><br \/>\n<span class=\"field field--name-created field--type-created field--label-hidden\">Thu, 12\/15\/2022 &#8211; 03:00<\/span><\/p>\n<div class=\"clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item\">\n<p>Open source software projects often have a very diverse user group. Some users might be very adept at using the system and need very little documentation. For these power users, documentation might only need to be reminders and hints, and can include more technical information such as commands to run at the shell. But other users may be beginners. These users need more help in setting up the system and learning how to use it.<\/p>\n<p>Writing documentation that suits both user groups can be daunting. The website&#8217;s documentation needs to somehow balance &#8220;detailed technical information&#8221; with &#8220;providing more overview and guidance.&#8221; This is a difficult balance to find. If your documentation can&#8217;t meet both user groups, consider a third option \u2014 dynamic documentation.<\/p>\n<p>Explore how to add a little <a href=\"https:\/\/opensource.com\/downloads\/learn-javascript\" target=\"_blank\" rel=\"noopener\">JavaScript<\/a> to a web page so the user can choose to display just the information they want to see.<\/p>\n<h2>Structure your content<\/h2>\n<p>You can use the example where documentation needs to suit both expert and novice users. In the simplest case, you can use a made-up music player called AwesomeProject.<\/p>\n<p>You can write a short installation document in HTML that provides instructions for both experts and novices by using the class feature in HTML. For example, you can define a paragraph intended for experts by using:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"html5 geshifilter-html5\"><span class=\"sc2\"><span class=\"kw2\">p<\/span> <span class=\"kw3\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">\"expert reader\"<\/span>&gt;<\/span> <\/code><\/span><\/pre>\n<p>This assigns both the expert class and the reader class. You can create a parallel set of instructions for novices using:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"html5 geshifilter-html5\"><span class=\"sc2\"><span class=\"kw2\">p<\/span> <span class=\"kw3\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">\"novice reader\"<\/span>&gt;<\/span> <\/code><\/span><\/pre>\n<p>The complete HTML file includes both paragraphs for novice readers and experts:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"html5 geshifilter-html5\"><span class=\"sc0\"><br><br><span class=\"sc2\"><span class=\"kw2\">html<\/span> <span class=\"kw3\">lang<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">\"en\"<\/span>&gt;<\/span><br><br><span class=\"sc2\"><span class=\"kw2\">head<\/span>&gt;<\/span><br><br><span class=\"sc2\"><span class=\"kw2\">title<\/span>&gt;<\/span>How to install the software<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/title.html\"><span class=\"kw2\">title<\/span><\/a>&gt;<\/span><br><span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/head.html\"><span class=\"kw2\">head<\/span><\/a>&gt;<br><br><span class=\"sc2\"><span class=\"kw2\">body<\/span>&gt;<\/span><br><br><span class=\"sc2\"><span class=\"kw2\">h1<\/span>&gt;<\/span>How to install the software<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/h1.html\"><span class=\"kw2\">h1<\/span><\/a>&gt;<br><br><span class=\"sc2\"><span class=\"kw2\">p<\/span>&gt;<\/span>Thanks for installing AwesomeProject! With AwesomeProject,<br>\nyou can manage your music collection like a wizard.<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br><br><span class=\"sc2\"><span class=\"kw2\">p<\/span>&gt;<\/span>But first, we need to install it:<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br><br><span class=\"sc2\"><span class=\"kw2\">p<\/span> <span class=\"kw3\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">\"expert reader\"<\/span>&gt;<\/span>You can install AwesomeProject from<br>\nsource. Download the tar file, extract it, then run:<br><span class=\"sc2\"><span class=\"kw2\">code<\/span>&gt;<\/span>.\/configure ; make ; make install<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/code.html\"><span class=\"kw2\">code<\/span><\/a>&gt;\/<a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br><br><span class=\"sc2\"><span class=\"kw2\">p<\/span> <span class=\"kw3\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">\"novice reader\"<\/span>&gt;<\/span>AwesomeProject is available in<br>\nmost Linux distributions. Check your graphical package manager and search for AwesomeProject to install it.<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br><br><span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/body.html\"><span class=\"kw2\">body<\/span><\/a>&gt;<br><br><span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/html.html\"><span class=\"kw2\">html<\/span><\/a>&gt;<\/div><\/div><\/pre>\n<p>This sample HTML document doesn&#8217;t have a stylesheet associated with it, so viewing this in a web browser shows both paragraphs:<\/p>\n<article class=\"align-center media media--type-image media--view-mode-default\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/12\/publishonec.textblack.png\" width=\"497\" height=\"298\" alt=\"Image of html in black text.\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>(Jim Hall, CC BY-SA 4.0)<\/p>\n<\/div>\n<\/article>\n<p>We can apply some basic styling to the document to highlight any element with the reader, expert, or novice classes. To make the different text classes easier to differentiate, let&#8217;s set the reader class to an off-white background color, expert to a dark red text color, and novice to a dark blue text color:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"html5 geshifilter-html5\"><span class=\"sc0\"><br><br><span class=\"sc2\"><span class=\"kw2\">html<\/span> <span class=\"kw3\">lang<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">\"en\"<\/span>&gt;<\/span><br><br><span class=\"sc2\"><span class=\"kw2\">head<\/span>&gt;<\/span><br><br><span class=\"sc2\"><span class=\"kw2\">title<\/span>&gt;<\/span>How to install the software<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/title.html\"><span class=\"kw2\">title<\/span><\/a>&gt;<\/span><br><br><span class=\"sc2\"><span class=\"kw2\">style<\/span>&gt;<\/span><br><br>\n.reader {<br>\nbackground-color: ghostwhite;<br>\n}<br><br>\n.expert {<br>\ncolor: darkred;<br>\n}<br><br>\n.novice {<br>\ncolor: darkblue;<br>\n}<br><br><span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/style.html\"><span class=\"kw2\">style<\/span><\/a>&gt;<br><br><span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/head.html\"><span class=\"kw2\">head<\/span><\/a>&gt;<br><br><span class=\"sc2\"><span class=\"kw2\">body<\/span>&gt;<\/span><br><br><span class=\"sc2\"><span class=\"kw2\">h1<\/span>&gt;<\/span>How to install the software<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/h1.html\"><span class=\"kw2\">h1<\/span><\/a>&gt;<\/div><\/div><\/pre>\n<p>These styles help the two sections stand out when you view the page in a web browser. Both paragraphs with the installation instructions have an off-white background color because they both have the reader class. The first paragraph uses dark red text, as defined by the expert class. The second installation paragraph is in dark blue text, from the novice class:<\/p>\n<article class=\"align-center media media--type-image media--view-mode-default\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/12\/publishone.red_.blue_.png\" width=\"513\" height=\"335\" alt=\"Image of html in red and black text.\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>(Jim Hall, CC BY-SA 4.0)<\/p>\n<\/div>\n<\/article>\n<div class=\"embedded-resource-list callout-float-right\">\n<div class=\"field field--name-title field--type-string field--label-hidden field__item\">More great content<\/div>\n<div class=\"field field--name-links field--type-link field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/www.redhat.com\/en\/services\/training\/rh024-red-hat-linux-technical-overview?intcmp=7016000000127cYAAQ\">Free online course: RHEL technical overview<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/developers.redhat.com\/cheat-sheets\/advanced-linux-commands\/?intcmp=7016000000127cYAAQ\">Learn advanced Linux commands<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/cheat-sheets?intcmp=7016000000127cYAAQ\">Download cheat sheets<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/linux?intcmp=7016000000127cYAAQ\">Find an open source alternative<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/resources?intcmp=7016000000127cYAAQ\">Explore open source resources<\/a><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<h2>Add JavaScript controls<\/h2>\n<p>With these classes applied, you can add a short JavaScript function that shows just one of the content blocks. One way to write this function is to first set <code>display:none<\/code> to all of the elements with the reader class. This hides the content so it won&#8217;t display on the page. Then the function should set <code>display:block<\/code> to each of the elements with the class you want to display:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"java geshifilter-java\"><span class=\"sy0\">script<span class=\"sy0\">&gt;<\/span><br>\nfunction readerview<span class=\"br0\">(<\/span>audience<span class=\"br0\">)<\/span> <span class=\"br0\">{<\/span><br>\n\u00a0 var list, item<span class=\"sy0\">;<\/span><br>\n\u00a0 <span class=\"co1\">\/\/ hide all class=\"reader\"<\/span><br>\n\u00a0 list <span class=\"sy0\">=<\/span> document.<span class=\"me1\">getElementsByClassName<\/span><span class=\"br0\">(<\/span><span class=\"st0\">\"reader\"<\/span><span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><br>\n\u00a0 <span class=\"kw1\">for<\/span> <span class=\"br0\">(<\/span>item <span class=\"sy0\">=<\/span> <span class=\"nu0\">0<\/span><span class=\"sy0\">;<\/span> item <span class=\"sy0\"> list.<span class=\"me1\">length<\/span><span class=\"sy0\">;<\/span> item<span class=\"sy0\">++<\/span><span class=\"br0\">)<\/span> <span class=\"br0\">{<\/span><br>\n\u00a0 \u00a0 list<span class=\"br0\">[<\/span>item<span class=\"br0\">]<\/span>.<span class=\"me1\">style<\/span>.<span class=\"me1\">display<\/span> <span class=\"sy0\">=<\/span> <span class=\"st0\">\"none\"<\/span><span class=\"sy0\">;<\/span><br>\n\u00a0 <span class=\"br0\">}<\/span><br>\n\u00a0 <span class=\"co1\">\/\/ show all class=audience<\/span><br>\n\u00a0 list <span class=\"sy0\">=<\/span> document.<span class=\"me1\">getElementsByClassName<\/span><span class=\"br0\">(<\/span>audience<span class=\"br0\">)<\/span><span class=\"sy0\">;<\/span><br>\n\u00a0 <span class=\"kw1\">for<\/span> <span class=\"br0\">(<\/span>item <span class=\"sy0\">=<\/span> <span class=\"nu0\">0<\/span><span class=\"sy0\">;<\/span> item <span class=\"sy0\"> list.<span class=\"me1\">length<\/span><span class=\"sy0\">;<\/span> item<span class=\"sy0\">++<\/span><span class=\"br0\">)<\/span> <span class=\"br0\">{<\/span><br>\n\u00a0 \u00a0 list<span class=\"br0\">[<\/span>item<span class=\"br0\">]<\/span>.<span class=\"me1\">style<\/span>.<span class=\"me1\">display<\/span> <span class=\"sy0\">=<\/span> <span class=\"st0\">\"block\"<\/span><span class=\"sy0\">;<\/span><br>\n\u00a0 <span class=\"br0\">}<\/span><br><span class=\"br0\">}<\/span><br><span class=\"sy0\"><\/span>script<span class=\"sy0\">&gt;<\/span><\/span><\/span><\/span><\/div><\/div><\/pre>\n<p>To use this JavaScript in the HTML document, you can attach the function to a button. Since the <code>readerview <\/code>function takes an audience as its parameter, you can call the function with the audience class that you want to view, either novice or expert:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"html5 geshifilter-html5\"><span class=\"sc0\"><br><br><span class=\"sc2\"><span class=\"kw2\">html<\/span> <span class=\"kw3\">lang<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">\"en\"<\/span>&gt;<\/span><br><br><span class=\"sc2\"><span class=\"kw2\">head<\/span>&gt;<\/span><br><br><span class=\"sc2\"><span class=\"kw2\">title<\/span>&gt;<\/span>How to install the software<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/title.html\"><span class=\"kw2\">title<\/span><\/a>&gt;<\/span><br><br><span class=\"sc2\"><span class=\"kw2\">style<\/span>&gt;<\/span><br><br>\n.reader {<br>\nbackground-color: ghostwhite;<br>\n}<br><br>\n.expert {<br>\ncolor: darkred;<br>\n}<br><br>\n.novice {<br>\ncolor: darkblue;<br>\n}<br><br><span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/style.html\"><span class=\"kw2\">style<\/span><\/a>&gt;<br><br><span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/head.html\"><span class=\"kw2\">head<\/span><\/a>&gt;<br><br><span class=\"sc2\"><span class=\"kw2\">body<\/span>&gt;<\/span><br><br><span class=\"sc2\"><span class=\"kw2\">script<\/span>&gt;<\/span><br><br>\nfunction readerview(audience) {<br>\n\u00a0 var list, item;<br><br>\n\u00a0 \/\/ hide all class=\"reader\"<br><br>\n\u00a0 list = document.getElementsByClassName(\"reader\");<br><br>\n\u00a0 for (item = 0; item <span class=\"sc2\">)<\/span> <span class=\"br0\">{<\/span><br><br><span class=\"sc2\"> \u00a0 \u00a0list<span class=\"br0\">[<\/span>item<span class=\"br0\">]<\/span>.<span class=\"kw3\">style<\/span>.display <span class=\"sy0\">=<\/span> <span class=\"st0\">\"none\"<\/span>;<\/span><br><span class=\"sc2\"> \u00a0<span class=\"br0\">}<\/span><\/span><br><br><span class=\"sc2\"> \u00a0<span class=\"sy0\">\/\/<\/span> show all <span class=\"kw3\">class<\/span><span class=\"sy0\">=<\/span>audience<\/span><br><br><span class=\"sc2\"> \u00a0list <span class=\"sy0\">=<\/span> document.getElementsByClassName<span class=\"br0\">(<\/span>audience<span class=\"br0\">)<\/span>;<\/span><br><br><span class=\"sc2\"> \u00a0<span class=\"kw3\">for<\/span> <span class=\"br0\">(<\/span>item <span class=\"sy0\">=<\/span> <span class=\"nu0\">0<\/span>; item )<\/span> <span class=\"br0\">{<\/span><br><br><span class=\"sc2\"> \u00a0 \u00a0list<span class=\"br0\">[<\/span>item<span class=\"br0\">]<\/span>.<span class=\"kw3\">style<\/span>.display <span class=\"sy0\">=<\/span> <span class=\"st0\">\"block\"<\/span>;<\/span><br><span class=\"sc2\"> \u00a0<span class=\"br0\">}<\/span><\/span><br><br><span class=\"sc2\"><span class=\"br0\">}<\/span><\/span><br><br><span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/script.html\"><span class=\"kw2\">script<\/span><\/a>&gt;<br><br><span class=\"sc2\"><span class=\"kw2\">h1<\/span>&gt;<\/span>How to install the software<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/h1.html\"><span class=\"kw2\">h1<\/span><\/a>&gt;<br><br><span class=\"sc2\"><span class=\"kw2\">nav<\/span>&gt;<\/span><br><br><span class=\"sc2\"><span class=\"kw2\">button<\/span> <span class=\"kw3\">onclick<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">\"readerview('novice')\"<\/span>&gt;<\/span>view novice text<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/button.html\"><span class=\"kw2\">button<\/span><\/a>&gt;<br><br><span class=\"sc2\"><span class=\"kw2\">button<\/span> <span class=\"kw3\">onclick<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">\"readerview('expert')\"<\/span>&gt;<\/span>view expert text<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/button.html\"><span class=\"kw2\">button<\/span><\/a>&gt;<br><br><span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/nav.html\"><span class=\"kw2\">nav<\/span><\/a>&gt;<br><br><span class=\"sc2\"><span class=\"kw2\">p<\/span>&gt;<\/span>Thanks for installing AwesomeProject! With AwesomeProject,<br>\nyou can manage your music collection like a wizard.<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br><br><span class=\"sc2\"><span class=\"kw2\">p<\/span>&gt;<\/span>But first, we need to install it:<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br><span class=\"sc2\"><span class=\"kw2\">p<\/span> <span class=\"kw3\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">\"expert reader\"<\/span>&gt;<\/span>You can install AwesomeProject from<br>\nsource. Download the tar file, extract it, then run<br><span class=\"sc2\"><span class=\"kw2\">code<\/span>&gt;<\/span>.\/configure ; make ; make install<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/code.html\"><span class=\"kw2\">code<\/span><\/a>&gt;\/<a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br><br><span class=\"sc2\"><span class=\"kw2\">p<\/span> <span class=\"kw3\">class<\/span><span class=\"sy0\">=<\/span><span class=\"st0\">\"novice reader\"<\/span>&gt;<\/span>AwesomeProject is available in<br>\nmost Linux distributions. Check your graphical package<br>\nmanager and search for AwesomeProject to install it.<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br><br><span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/body.html\"><span class=\"kw2\">body<\/span><\/a>&gt;<br><br><span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/html.html\"><span class=\"kw2\">html<\/span><\/a>&gt;<\/div><\/div><\/pre>\n<p>\u00a0<\/p>\n<p>With these controls in place, the web page now allows the user to select the text they want to see:<\/p>\n<p>\u00a0<\/p>\n<article class=\"align-center media media--type-image media--view-mode-default\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/12\/publishone.novicexpert.png\" width=\"513\" height=\"375\" alt=\"Image of window that allows you to select between novice and expert text.\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>(Jim Hall, CC BY-SA 4.0)<\/p>\n<\/div>\n<\/article>\n<p>Clicking either button will show just the text the user wants to read. For example, if you click the \u201cview novice text\u201d button, then you&#8217;ll see just the blue paragraph:<\/p>\n<article class=\"align-center media media--type-image media--view-mode-default\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/12\/publishone.blue_.png\" width=\"513\" height=\"313\" alt=\"Image showing blue text when you press the novice button.\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>(Jim Hall, CC BY-SA 4.0)<\/p>\n<\/div>\n<\/article>\n<p>Clicking the \u201cview expert text\u201d button hides the novice text and shows only the expert text in red:<\/p>\n<article class=\"align-center media media--type-image media--view-mode-default\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/12\/publishone.red_.png\" width=\"513\" height=\"290\" alt=\"Image of red text after the expert button is clicked.\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>(Jim Hall, CC BY-SA 4.0)<\/p>\n<\/div>\n<\/article>\n<h2>Extend this to your documentation<\/h2>\n<p>If your project requires you to write multiple how-to documents for different audiences, consider using this method to publish once and read twice. Writing a single document for all your users makes it easy for everyone to find and share the documentation for your project. And you won&#8217;t have to maintain parallel documentation that varies in just the details.<\/p>\n<\/div>\n<div class=\"clearfix text-formatted field field--name-field-article-subhead field--type-text-long field--label-hidden field__item\">\n<p>Make your open source project documentation dynamic so it appeals to users of all experience levels.<\/p>\n<\/div>\n<div class=\"field field--name-field-lead-image field--type-entity-reference field--label-hidden field__item\">\n<article class=\"media media--type-image media--view-mode-caption\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/12\/osdc-docdish-typewriter-pink.png\" width=\"520\" height=\"292\" alt=\"pink typewriter\" title=\"A pink typewriter\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>Original photo by\u00a0Marco Tedaldi. Modified by Rikki Endsley.\u00a0CC BY-SA 2.0.<\/p>\n<\/div>\n<\/article>\n<\/div>\n<div class=\"field field--name-field-tags field--type-entity-reference field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/documentation\" hreflang=\"en\">Documentation<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/javascript\" hreflang=\"en\">JavaScript<\/a><\/div>\n<\/p><\/div>\n<div class=\"hidden field field--name-field-listicle-title field--type-string field--label-hidden field__item\">What to read next<\/div>\n<div class=\"field field--name-field-default-license field--type-list-string field--label-hidden field__item\"><a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\"><br \/>\n        <img decoding=\"async\" alt=\"Creative Commons License\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/12\/cc-by-sa--29.png\" title=\"This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.\"><\/a>This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.<\/div>\n<section class=\"field field--name-field-comments field--type-comment field--label-hidden comment-wrapper\">\n<div class=\"comments__count\">\n<div class=\"login\"><a href=\"https:\/\/opensource.com\/user\/register?absolute=1\">Register<\/a> or <a href=\"https:\/\/opensource.com\/user\/login?destination=\/feed&amp;absolute=1\">Login<\/a> to post a comment.<\/div>\n<\/p><\/div>\n<\/section>\n<p class=\"wpematico_credit\"><small>Powered by <a href=\"http:\/\/www.wpematico.com\" target=\"_blank\" rel=\"noopener\">WPeMatico<\/a><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Improve your documentation with JavaScript Jim Hall Thu, 12\/15\/2022 &#8211; 03:00 Open source software projects often have a very diverse user group. Some users might be very adept at using the system and need very little documentation. For these power users, documentation might only need to be reminders and hints, and can include more technical [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":69496,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[307],"tags":[],"class_list":["post-69495","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-open-source"],"_links":{"self":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/69495","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=69495"}],"version-history":[{"count":0,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/69495\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/media\/69496"}],"wp:attachment":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=69495"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=69495"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=69495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}