diff --git a/documentation/content/en/books/fdp-primer/editor-config/_index.adoc b/documentation/content/en/books/fdp-primer/editor-config/_index.adoc index 1b0797132a..1b822380ed 100644 --- a/documentation/content/en/books/fdp-primer/editor-config/_index.adoc +++ b/documentation/content/en/books/fdp-primer/editor-config/_index.adoc @@ -1,335 +1,347 @@ --- title: Chapter 12. Editor Configuration prev: books/fdp-primer/writing-style next: books/fdp-primer/trademarks description: Configuration used in the texts editors in the FreeBSD Documentation Project tags: ["editor", "configuration", "vim", "emacs", "FreeBSD"] showBookMenu: true weight: 13 path: "/books/fdp-primer/" --- [[editor-config]] = Editor Configuration :doctype: book :toc: macro :toclevels: 1 :icons: font :sectnums: :sectnumlevels: 6 :sectnumoffset: 12 :partnums: :source-highlighter: rouge :experimental: :images-path: books/fdp-primer/ ifdef::env-beastie[] ifdef::backend-html5[] :imagesdir: ../../../../images/{images-path} endif::[] ifndef::book[] include::shared/authors.adoc[] include::shared/mirrors.adoc[] include::shared/releases.adoc[] include::shared/attributes/attributes-{{% lang %}}.adoc[] include::shared/{{% lang %}}/teams.adoc[] include::shared/{{% lang %}}/mailing-lists.adoc[] include::shared/{{% lang %}}/urls.adoc[] toc::[] endif::[] ifdef::backend-pdf,backend-epub3[] include::../../../../../shared/asciidoctor.adoc[] endif::[] endif::[] ifndef::env-beastie[] toc::[] include::../../../../../shared/asciidoctor.adoc[] endif::[] Adjusting your text editor configuration can make working on document files quicker and easier, and help documents conform to FDP guidelines. [[editor-config-vim]] == Vim Install from package:editors/vim[], or package:editors/vim-console[], then follow the configuration instructions in <>. More advanced users can use a proper linter like link:https://github.com/dense-analysis/ale[Ale] which can also act as a Vim link:https://langserver.org/[Language Server Protocol] client. [[editor-config-vim-use]] === Use Manual page writers can use the following keyboard shortcuts to reformat: ++ * Press kbd:[P] to reformat paragraphs or text that has been selected in Visual mode. * Press kbd:[T] to replace groups of eight spaces with a tab. A linter named link:https://vale.sh[Vale] has been introduced to check grammatical and cosmetic errors on the documents. Vale has support for various editors and IDEs. -Install package:textproc/vale[] +Vale may already be installed as a dependency of the package:textproc/docproj[] meta-port. +If not, install package:textproc/vale[] with: -[source,shell] +[source,console] .... $ pkg install vale .... Install link:https://github.com/dense-analysis/ale[Ale] to integrate into package:editors/vim[], for using package:textproc/vale[] -[source,shell] +[source,console?prompt=%] .... % mkdir -p ~/.vim/pack/vendor/start % git clone --depth 1 https://github.com/dense-analysis/ale.git ~/.vim/pack/vendor/start/ale .... -Users who are using plugin managers for package:editors/vim[] do not need the above and should follow the instructions of the plugin manager to install link:https://github.com/dense-analysis/ale[Ale] +Users who are using plugin managers for package:editors/vim[] do not need the above and should follow the instructions of that plugin manager to install link:https://github.com/dense-analysis/ale[Ale]. -At this moment due to a bug in the link:https://vale.sh[Vale] it is necessary to copy the link:https://vale.sh[Vale] configurations to the home directory. +At this moment due to a bug in link:https://vale.sh[Vale] it is necessary to copy the link:https://vale.sh[Vale] configuration to the home directory. Considering the repository was cloned into [.filename]#~/doc# copy as following: -[source,shell] +[source,console?prompt=%] .... % cp -R ~/doc/.vale* ~/ .... [[editor-config-vim-config]] === Configuration Edit [.filename]#~/.vimrc#, adding these lines to the end of the file: -[.programlisting] +[source.programlisting,viml] +.`~/.vimrc` .... if has("autocmd") au BufNewFile,BufRead *.adoc call Set_ADOC() au BufNewFile,BufRead *.[1-9] call Set_MAN() endif " has(autocmd) function Set_Highlights() "match ExtraWhitespace /^\s* \s*\|\s\+$/ return 0 endfunction " Set_Highlights_Adoc() function Set_Highlights_MAN() highlight default link OverLength ErrorMsg match OverLength /\%71v.\+/ return 0 endfunction " Set_Highlights_MAN() function ShowSpecial() setlocal list listchars=tab:>>,trail:*,eol:$ hi def link nontext ErrorMsg return 0 endfunction " ShowSpecial() function Set_COMMON() setlocal number setlocal shiftwidth=2 setlocal tabstop=8 setlocal softtabstop=2 setlocal formatprg="fmt -p" setlocal autoindent setlocal smartindent call ShowSpecial() call Set_Highlights() return 0 endfunction " Set_COMMON() function Set_ADOC() setlocal syntax=asciidoc setlocal filetype=asciidoc call Set_COMMON() return 0 endfunction " Set_ADOC() function Set_MAN() setlocal syntax=man setlocal filetype=man setlocal textwidth=70 " Rewrap paragraphs noremap P gqj " Replace spaces with tabs noremap T :s/ /\t/ call Set_COMMON() call Set_Highlights_MAN() return 0 endfunction " Set_Man() let g:ale_fixers = { \ '*': ['remove_trailing_lines', 'trim_whitespace'], \} let g:ale_linters = { \ 'asciidoc': ['vale'], \} let g:ale_fix_on_save = 1 .... [IMPORTANT] ====== Above configuration will automatically remove trailing line, trailing space and multiple spaces which might display additional unwanted changes in `git diff` output. In such cases properly mention that in the commit log. ====== [[editor-config-emacs]] == Emacs Install from package:editors/emacs[] or package:editors/emacs-devel[]. [[editor-config-emacs-validation]] === Validation Emacs's nxml-mode uses compact relax NG schemas for validating XML. A compact relax NG schema for FreeBSD's extension to DocBook 5.0 is included in the documentation repository. To configure nxml-mode to validate using this schema, create [.filename]#~/.emacs.d/schema/schemas.xml# and add these lines to the file: +[source,xml] +.`~/.emacs.d/schema/schemas.xml` .... -locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0" - documentElement localName="section" typeId="DocBook" - documentElement localName="chapter" typeId="DocBook" - documentElement localName="article" typeId="DocBook" - documentElement localName="book" typeId="DocBook" - typeId id="DocBook" uri="/usr/local/share/xml/docbook/5.0/rng/docbook.rnc" -locatingRules + + + + + + + .... [[editor-config-emacs-igor]] === Automated Proofreading with Flycheck and Igor -The Flycheck package is available from Milkypostman's Emacs Lisp Package Archive (MELPA). +The link:https://www.flycheck.org/[Flycheck] package is available from link:https://melpa.org/[Milkypostman's Emacs Lisp Package Archive] (MELPA). If MELPA is not already in Emacs's packages-archives, it can be added by evaluating +[source,emacs-lisp] .... (add-to-list 'package-archives '("melpa" . "http://stable.melpa.org/packages/") t) .... Add the line to Emacs's initialization file (one of [.filename]#~/.emacs#, [.filename]#~/.emacs.el#, or [.filename]#~.emacs.d/init.el#) to make this change permanent. To install Flycheck, evaluate +[source,emacs-lisp] .... (package-install 'flycheck) .... Create a Flycheck checker for package:textproc/igor[] by evaluating +[source,emacs-lisp] .... (flycheck-define-checker igor "FreeBSD Documentation Project sanity checker. See URLs https://www.freebsd.org/docproj/ and http://www.freshports.org/textproc/igor/." :command ("igor" "-X" source-inplace) :error-parser flycheck-parse-checkstyle :modes (nxml-mode) :standard-input t) (add-to-list 'flycheck-checkers 'igor 'append) .... Again, add these lines to Emacs's initialization file to make the changes permanent. [[editor-config-emacs-specifc]] === FreeBSD Documentation Specific Settings To apply settings specific to the FreeBSD documentation project, create [.filename]#.dir-locals.el# in the root directory of the documentation repository and add these lines to the file: .... ;;; Directory Local Variables ;;; For more information see (info "(emacs) Directory Variables") ((nxml-mode (eval . (turn-on-auto-fill)) (fill-column . 70) (eval . (require 'flycheck)) (eval . (flycheck-mode 1)) (flycheck-checker . igor) (eval . (add-to-list 'rng-schema-locating-files "~/.emacs.d/schema/schemas.xml")))) .... [[editor-config-nano]] == nano Install from package:editors/nano[] or package:editors/nano-devel[]. [[editor-config-nano-config]] === Configuration -Currently there is no adoc/asciidoc syntax highlight file with nano distribution. So let's create one from scratch and use an editor to create new file or add lines in the [.filename]#~/.nanorc# with these contents: +Currently there is no adoc/asciidoc syntax highlight file with nano distribution. +So let's create one from scratch and use an editor to create new file or add lines in the [.filename]#~/.nanorc# with these contents: +[source] +.`~/.nanorc` .... syntax "asciidoc" "\.(adoc|asc|asciidoc)$" # main header color red "^====+$" # h1 color red "^==[[:space:]].*$" color red "^----+$" # h2 color magenta "^===[[:space:]].*$" color magenta "^~~~~+$" # h4 color green "^====[[:space:]].*$" color green "^\^\^\^\^+$" # h5 color brightblue "^=====[[:space:]].*$" color brightblue "^\+\+\+\++$" # attributes color brightgreen ":.*:" color brightred "\{[a-z0-9]*\}" color red "\\\{[a-z0-9]*\}" color red "\+\+\+\{[a-z0-9]*\}\+\+\+" # Paragraph Title color yellow "^\..*$" # source color magenta "^\[(source,.+|NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]" # Other markup color yellow ".*[[:space:]]\+$" color yellow "_[^_]+_" color yellow "\*[^\*]+\*" color yellow "\+[^\+]+\+" color yellow "`[^`]+`" color yellow "\^[^\^]+\^" color yellow "~[^~]+~" color yellow "'[^']+'" color cyan "`{1,2}[^']+'{1,2}" # bullets color brightmagenta "^[[:space:]]*[\*\.-]{1,5}[[:space:]]" # anchors color brightwhite "\[\[.*\]\]" color brightwhite "<<.*>>" # trailing whitespace color ,blue "[[:space:]]+$" # multiples of eight spaces at the start a line # (after zero or more tabs) should be a tab color ,blue "^([TAB]*[ ]{8})+" # tabs after spaces color ,yellow "( )+TAB" # highlight indents that have an odd number of spaces color ,red "^(([ ]{2})+|(TAB+))*[ ]{1}[^ ]{1}" .... Process the file to create embedded tabs: -[source,shell] +[source,console?prompt=%] .... % perl -i'' -pe 's/TAB/\t/g' ~/.nanorc .... [[editor-config-nano-use]] === Use Specify additional helpful options when running the editor: -[source,shell] +[source,console?prompt=%] .... % nano -AKipwz -T8 _index.adoc .... Users of man:csh[1] can define an alias in [.filename]#~/.cshrc# to automate these options: +[source,shell] .... alias nano "nano -AKipwz -r 70 -T8" .... After the alias is defined, the options will be added automatically: -[source,shell] +[source,console?prompt=%] .... % nano _index.adoc .... diff --git a/documentation/content/en/books/fdp-primer/structure/_index.adoc b/documentation/content/en/books/fdp-primer/structure/_index.adoc index b35fb23373..25f3ad19f4 100644 --- a/documentation/content/en/books/fdp-primer/structure/_index.adoc +++ b/documentation/content/en/books/fdp-primer/structure/_index.adoc @@ -1,259 +1,259 @@ --- title: Chapter 4. Documentation Directory Structure prev: books/fdp-primer/working-copy next: books/fdp-primer/doc-build description: Documentation Directory Structure explanation used in the FreeBSD Documentation Project tags: ["directory structure", "organization"] showBookMenu: true weight: 5 path: "/books/fdp-primer/" --- [[structure]] = Documentation Directory Structure :doctype: book :toc: macro :toclevels: 1 :icons: font :sectnums: :sectnumlevels: 6 :sectnumoffset: 4 :partnums: :source-highlighter: rouge :experimental: :images-path: books/fdp-primer/ ifdef::env-beastie[] ifdef::backend-html5[] :imagesdir: ../../../../images/{images-path} endif::[] ifndef::book[] include::shared/authors.adoc[] include::shared/mirrors.adoc[] include::shared/releases.adoc[] include::shared/attributes/attributes-{{% lang %}}.adoc[] include::shared/{{% lang %}}/teams.adoc[] include::shared/{{% lang %}}/mailing-lists.adoc[] include::shared/{{% lang %}}/urls.adoc[] toc::[] endif::[] ifdef::backend-pdf,backend-epub3[] include::../../../../../shared/asciidoctor.adoc[] endif::[] endif::[] ifndef::env-beastie[] toc::[] include::../../../../../shared/asciidoctor.adoc[] endif::[] Files and directories in the *doc/* tree follow a structure meant to: . Make it easy to automate converting the document to other formats. . Promote consistency between the different documentation organizations, to make it easier to switch between working on different documents. . Make it easy to decide where in the tree new documentation should be placed. In addition, the documentation tree must accommodate documents in many different languages. It is important that the documentation tree structure does not enforce any particular defaults or cultural preferences. [[structure-top]] == The Top Level, doc/ There are three sections under *doc/*, documentation and website share the same structure. [cols="20%,80%", frame="none", options="header"] |=== | Directory | Usage | *documentation* | Contains all the articles and books in AsciiDoc format. Contains subdirectories to further categorize the information by languages. | *tools* | Contains a set of tools used to translate the documentation and the website using link:https://weblate.org/en/[Weblate]. The Weblate instance can be found link:https://translate-dev.freebsd.org[here]. | *shared* | Contains files that are not specific to the various translations of the documentation. Contains subdirectories to further categorize the information by languages and three files to store the authors, releases and mirrors information. This directory is shared between `documentation` and the `website`. | *website* | Contains the link:https://www.FreeBSD.org[FreeBSD website] in AsciiDoc format. Contains subdirectories to further categorize the information by languages. |=== [[structure-locale]] == The Directories These directories contain the documentation and the website. The documentation is organized into subdirectories below this level, following the link:https://gohugo.io/getting-started/directory-structure/[Hugo directory structure]. [cols="20%,80%", frame="none", options="header"] |=== | Directory | Usage | *archetypes* | Contain templates to create new articles, books and webpages. For more information take a look link:https://gohugo.io/content-management/archetypes/[here]. | *config* | Contain the Hugo configuration files. One main file and one file per language. For more information take a look link:https://gohugo.io/getting-started/configuration/[here]. | *content* | Contain the books, articles and webpages. One directory exists for each available translation of the documentation, for example `en` and `zh-tw`. | *data* | Contain custom data for build the website in link:https://en.wikipedia.org/wiki/TOML[TOML] format. This directory is used to store the events, news, press, etc. For more information take a look link:https://gohugo.io/templates/data-templates/[here]. | *static* | Contain static assets. Images, security advisories, the pgpkeys, etc. For more information take a look link:https://gohugo.io/content-management/static-files/[here]. | *themes* | Contain the templates in the form of `.html` files that specify how the website looks. For more information take a look link:https://gohugo.io/templates/[here]. | *tools* | Contain tools used to enhance the documentation build. For example to generate the Table of Contents of the books, etc. | *beastie.png* | This image doesn't need an introduction ;) | *LICENSE* | License of the documentation, shared and website. BSD 2-Clause License. | *Makefile* | The *Makefile* defines the build process of the documentation and the website. |=== [[structure-document]] == Document-Specific Information This section contains specific notes about particular documents managed by the FDP. [[structure-document-books]] == The Books: books/ The books are written in AsciiDoc. For each FreeBSD book, the AsciiDoc document type (aka doctype) is `book`. Books have ``part``s, each of which contains several ``chapter``s. When the document is converted to HTML 5 (using the built-in `html5` backend): * AsciiDoc section level 0 (`=`) at the beginning of a ``chapter`` of a `book` will be `

` * AsciiDoc section level 1 (`==`) must be used for the first logical section of a chapter, and will be `

` * AsciiDoc section level 2 (`===`) must be used for the first logical subsection, and will be `

` – and so on. Reference: link:https://docs.asciidoctor.org/asciidoc/latest/sections/titles-and-levels/[Section Titles and Levels | Asciidoctor Docs]. [[structure-document-books-physical]] === Physical Organization There are a number of files and directories within the books directory, all with the same structure. [[structure-document-books-physical-index]] ==== _index.adoc -The *_index.adoc* defines some AsciiDoc variables that affect how the AsciiDoc source is converted to other formats and list the Table of Contents, Table of Examples, Table of Figures, Table of Tables and the abstract section. +The *_index.adoc* file defines some AsciiDoc variables that affect how the AsciiDoc source is converted to other formats and list the Table of Contents, Table of Examples, Table of Figures, Table of Tables and the abstract section. [[structure-document-books-physical-book]] ==== book.adoc -The *_index.adoc* defines some AsciiDoc variables that affect how the AsciiDoc source is converted to other formats and list the Table of Contents, Table of Examples, Table of Figures, Table of Tables, the abstract section and all the chapters. +The *book.adoc* file defines some AsciiDoc variables that affect how the AsciiDoc source is converted to other formats and list the Table of Contents, Table of Examples, Table of Figures, Table of Tables, the abstract section and all the chapters. This file is used to generate the PDF with `asciidoctor-pdf` and to generate the book in one `html` page. [[structure-document-books-physical-part]] ==== part*.adoc -The *part*.adoc* files stores a brief introduction of one part of the book. +The **part*.adoc** files store a brief introduction of one part of the book. [[structure-document-handbook-physical-chapters]] ==== directory/_index.adoc Each chapter in the Handbook is stored in a file called *_index.adoc* in a separate directory from the other chapters. For example, this is an example of the header of one chapter: -[.programlisting] +[source.programlisting,asciidoc] .... --- title: Chapter 8. Configuring the FreeBSD Kernel part: Part II. Common Tasks prev: books/handbook/multimedia next: books/handbook/printing --- [[kernelconfig]] = Configuring the FreeBSD Kernel ... .... When the HTML5 version of the Handbook is produced, this will yield *kernelconfig/index.html*. A brief look will show that there are many directories with individual *_index.adoc* files, including *basics/_index.adoc*, *introduction/_index.adoc*, and *printing/_index.adoc*. [IMPORTANT] ==== Do not name chapters or directories after their ordering within the Handbook. This ordering can change as the content within the Handbook is reorganized. Reorganization should be possible without renaming files, unless entire chapters are being promoted or demoted within the hierarchy. ==== [[structure-document-articles]] == The Articles: articles/ The articles are written in AsciiDoc. The articles are organized as an AsciiDoc `article`. The articles are divided into sections (`=`) and subsections (`==`, `===`) and so on. [[structure-document-articles-physical]] === Physical Organization There is one *_index.adoc* file per article. [[structure-document-articles-physical-index]] ==== _index.adoc The *_index.adoc* file contains all the AsciiDoc variables and the content. For example, this is an example of one article, the structure is pretty similar to one book chapter: -[.programlisting] +[source.programlisting,asciidoc] .... --- title: Why you should use a BSD style license for your Open Source Project authors: - author: Bruce Montague email: brucem@alumni.cse.ucsc.edu trademarks: ["freebsd", "intel", "general"] --- = Why you should use a BSD style license for your Open Source Project :doctype: article :toc: macro :toclevels: 1 :icons: font :sectnums: :sectnumlevels: 6 :source-highlighter: rouge :experimental: ''' toc::[] [[intro]] == Introduction .... diff --git a/documentation/content/en/books/fdp-primer/writing-style/_index.adoc b/documentation/content/en/books/fdp-primer/writing-style/_index.adoc index 215d5d30eb..95f38f0c3b 100644 --- a/documentation/content/en/books/fdp-primer/writing-style/_index.adoc +++ b/documentation/content/en/books/fdp-primer/writing-style/_index.adoc @@ -1,370 +1,370 @@ --- title: Chapter 11. Writing Style prev: books/fdp-primer/manual-pages next: books/fdp-primer/editor-config description: Writing Style and some conventions used in the FreeBSD Documentation Project tags: ["writing", "style", "tipos", "one sentence per line"] showBookMenu: true weight: 12 path: "/books/fdp-primer/" --- [[writing-style]] = Writing Style :doctype: book :toc: macro :toclevels: 1 :icons: font :sectnums: :sectnumlevels: 6 :sectnumoffset: 11 :partnums: :source-highlighter: rouge :experimental: :images-path: books/fdp-primer/ ifdef::env-beastie[] ifdef::backend-html5[] :imagesdir: ../../../../images/{images-path} endif::[] ifndef::book[] include::shared/authors.adoc[] include::shared/mirrors.adoc[] include::shared/releases.adoc[] include::shared/attributes/attributes-{{% lang %}}.adoc[] include::shared/{{% lang %}}/teams.adoc[] include::shared/{{% lang %}}/mailing-lists.adoc[] include::shared/{{% lang %}}/urls.adoc[] toc::[] endif::[] ifdef::backend-pdf,backend-epub3[] include::../../../../../shared/asciidoctor.adoc[] endif::[] endif::[] ifndef::env-beastie[] toc::[] include::../../../../../shared/asciidoctor.adoc[] endif::[] [[writing-style-tips]] == Tips Technical documentation can be improved by consistent use of several principles. Most of these can be classified into three goals: _be clear_, _be complete_, and _be concise_. These goals can conflict with each other. Good writing consists of a balance between them. [[writing-style-be-clear]] === Be Clear Clarity is extremely important. The reader may be a novice, or reading the document in a second language. Strive for simple, uncomplicated text that clearly explains the concepts. Avoid flowery or embellished speech, jokes, or colloquial expressions. Write as simply and clearly as possible. Simple text is easier to understand and translate. Keep explanations as short, simple, and clear as possible. Avoid empty phrases like "in order to", which usually just means "to". Avoid potentially patronizing words like "basically". Avoid Latin terms like "i.e.," or "cf.", which may be unknown outside of academic or scientific groups. Write in a formal style. Avoid addressing the reader as "you". For example, say "copy the file to [.filename]#/tmp#" rather than "you can copy the file to [.filename]#/tmp#". Give clear, correct, _tested_ examples. A trivial example is better than no example. A good example is better yet. Do not give bad examples, identifiable by apologies or sentences like "but really it should never be done that way". Bad examples are worse than no examples. Give good examples, because _even when warned not to use the example as shown_, the reader will usually just use the example as shown. Avoid _weasel words_ like "should", "might", "try", or "could". These words imply that the speaker is unsure of the facts, and create doubt in the reader. Similarly, give instructions as imperative commands: not "you should do this", but merely "do this". [[writing-style-be-complete]] === Be Complete Do not make assumptions about the reader's abilities or skill level. Tell them what they need to know. Give links to other documents to provide background information without having to recreate it. Put yourself in the reader's place, anticipate the questions they will ask, and answer them. [[writing-style-be-concise]] === Be Concise While features should be documented completely, sometimes there is so much information that the reader cannot easily find the specific detail needed. The balance between being complete and being concise is a challenge. One approach is to have an introduction, then a "quick start" section that describes the most common situation, followed by an in-depth reference section. [[writing-style-guidelines]] == Guidelines To promote consistency between the myriad authors of the FreeBSD documentation, some guidelines have been drawn up for authors to follow. Use American English Spelling:: There are several variants of English, with different spellings for the same word. Where spellings differ, use the American English variant. "color", not "colour", "rationalize", not "rationalise", and so on. + [NOTE] ==== The use of British English may be accepted in the case of a contributed article, however the spelling must be consistent within the whole document. The other documents such as books, web site, manual pages, etc. will have to use American English. ==== Do not use contractions:: Do not use contractions. Always spell the phrase out in full. "Don't use contractions" is wrong. + Avoiding contractions makes for a more formal tone, is more precise, and is slightly easier for translators. Use the serial comma:: In a list of items within a paragraph, separate each item from the others with a comma. Separate the last item from the others with a comma and the word "and". + For example: + This is a list of one, two and three items. + Is this a list of three items, "one", "two", and "three", or a list of two items, "one" and "two and three"? + It is better to be explicit and include a serial comma: + This is a list of one, two, and three items. Avoid redundant phrases:: Do not use redundant phrases. In particular, "the command", "the file", and "man command" are often redundant. + For example, commands: + Wrong: Use the `git` command to update sources. + Right: Use `git` to update sources. + Filenames: + Wrong: ... in the filename [.filename]#/etc/rc.local#... + Right: ... in [.filename]#/etc/rc.local#... + Manual page references (the second example uses `citerefentry` with the man:csh[1] entity):. + Wrong: See `man csh` for more information. + Right: See man:csh[1]. For more information about writing style, see http://www.bartleby.com/141/[Elements of Style], by William Strunk. [[writing-style-guide]] == Style Guide To keep the source for the documentation consistent when many different people are editing it, please follow these style conventions. [[one-sentence-per-line]] == One sentence per line Use Semantic Line Breaks in the documentation, a technique called "one sentence per line". The idea of this technique is to help the users to write and read documentation. To get more information about this technique read the link:https://sembr.org/[Semantic Line Breaks] page. This is an example which does not use "one sentence per line". .... All human beings are born free and equal in dignity and rights. They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood. .... And this is an example which uses the technique. .... All human beings are born free and equal in dignity and rights. They are endowed with reason and conscience and should act towards one another in a spirit of brotherhood. .... [[writing-style-acronyms]] === Acronyms Acronyms should be defined the first time they appear in a document, as in: "Network Time Protocol (NTP)". After the acronym has been defined, use the acronym alone unless it makes more sense contextually to use the whole term. Acronyms are usually defined only once per chapter or per document. All acronyms should be enclosed using the ` character. [[writing-style-special-characters]] == Special Character List This list of special characters shows the correct syntax and the output when used in FreeBSD documentation. If a character is not on this list, ask about it on the {freebsd-doc}. [.informaltable] [cols="1,1,1", frame="none", options="header"] |=== | Name | Syntax | Rendered | Copyright | +(C)+ | (C) | Registered | +(R)+ | (R) | Trademark | +(TM)+ | (TM) | Em dash | +--+ | -- | Ellipses | +...+ | ... | Single right arrow | +->+ | -> | Double right arrow | +=>+ | => | Single left arrow | +<-+ | <- | Double left arrow | +<=+ | <= |=== [[writing-style-linting-vale]] == Linting with Vale -To maintain clarity and consistency across all documentation and website link:https://vale.sh[Vale] styles has been introduced in the documentation tree. +To maintain clarity and consistency across all documentation and website pages, link:https://vale.sh[Vale] styles have been introduced in the documentation tree. link:https://vale.sh[Vale] is a powerful linter for writing customized rules and can be used in multiple scenarios. At this moment link:https://vale.sh[Vale] can be used as a command line tool, for CI/CD pipeline and integrated into editor of choice. The following table describes the current rule names and respective severity. [.informaltable] [cols="1,1", frame="none", options="header"] |=== | Name | Severity | BrandTerms | error | ConsciousLanguage | warning | Contractions | suggestions | EOLSpacing | warning | Hang | warning | Hyphens | warning | Repetition | warning | Spacing | error | Spelling | warning | Weasel | warning |=== [[writing-style-linting-vale-rules]] === Current Vale Rules . BrandTerms: Like The FreeBSD Project every major vendors and Companies have specific rules on writing their Brand Name. according to the Copyright rules of The FreeBSD Foundation *freebsd* should be written as *FreeBSD*. Similar to that care should be taken to be respective to other's brand value and write PostgreSQL, Node.js, Let's Encrypt etc. Missing brand names should be added to the [.filename]#.vale/styles/FreeBSD/BrandTerms.yml#" in the `doc` repository. . Contractions: Contracted words should not be used. This rule avoids all contractions and suggests full words. . Hang: `Hang` is often used to convey the meaning that the application has stopped responding. This rule proposes better wording. . Repetition: Same words are often typed twice when leaving the keyboard and rejoining the work again. This rule finds repeated words and warns the users. . Weasel: This rule handles avoiding weasel words. The uses of weasel words is controversial so at the moment the list of words are being evaluated and the severity level is marked as warning on. In case a frequently used word is marked as weasel word it should be removed from [.filename]#.vale/styles/FreeBSD/Weasel.yml#" in the `doc` repository. . ConsciousLanguage: This rule proposes uses of conscious languages like avoiding the words white/black/master/slave. . EOLSpacing: In most of the documents EOL spacing is present which is not the desirable situation. . Hyphens: Often adverbs ending with 'ly' are being added with a hyphen which is wrong. . Spacing: Often double spaces are hard to catch on plain eye which is addressed here. . Spelling: At the moment there is a mix of en_US and en_UK spellings in the documentation and website. A custom dictionary from link:https://wordlist.aspell.net[Aspell] has been added which uses strictly en_US and do not accept the en_UK variant of any words. It has also an exception list to ignore the FreeBSD specific terms. At the moment the list is a basic one with minimal words just as a proof of concept but if any word is found to be correct and not available in the dictionary the word should be added to the [.filename]#.vale/styles/FreeBSD/spelling-exceptions.txt#" in the `doc` repository. More rules will be introduced in the upcoming days when and where required. [[writing-style-using-vale]] === Using Vale link:https://vale.sh[Vale] can be used from command line and from within editor or IDE. package:textproc/vale[] can be installed as following: [source, shell] .... $ pkg install vale .... [[writing-style-using-vale-commandline]] ==== Using Vale in command line Considering the fact that `doc` repository was cloned into [.filename]#~/doc#" the following commands are required to run: [source, shell] .... % cd ~/doc % vale . .... [NOTE] ====== link:https://vale.sh[Vale] is a CPU and memory intensive program due to the nature of the application and can take a while to show any output on the screen. Better way to run the application is on specific folders or files rather than the entire `doc` repository as that is already done in the CI pipeline. ====== [[writing-style-using-vale-editors]] ==== Using Vale in editors link:https://vale.sh[Vale] works with major mainstream editors like package:editors/vim[], package:editors/emacs[], package:editors/vscode[]. At the moment the necessary configurations for package:editors/vim[] is described in crossref:editor-config[editor-config-vim, Vim]. Necessary configurations for package:editors/emacs[] is being worked on. diff --git a/documentation/themes/beastie/assets/styles/global.scss b/documentation/themes/beastie/assets/styles/global.scss index fb1fc6e687..a4b4c3ced8 100644 --- a/documentation/themes/beastie/assets/styles/global.scss +++ b/documentation/themes/beastie/assets/styles/global.scss @@ -1,759 +1,771 @@ /* * Copyright (c) 1994-2022, The FreeBSD Documentation Project * Copyright (c) 2021-2022, Sergio Carlavilla * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * */ html { font-family: 'Inter', -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif; scroll-padding-top: var(--header-height); scroll-behavior: auto; } @supports (font-variation-settings: normal) { html { font-family: 'Inter var', -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif; } } html, body { text-rendering: optimizeLegibility; line-height: 1.5; } body { display: flex; flex-direction: column; color: var(--global-font-color); padding: 0; margin: 0; font-size: 100%; font-weight: 400; font-style: normal; cursor: auto; background-color: var(--global-background-color); } /* Main */ .main-wrapper { display: flex; flex-direction: column; justify-content: center; margin: 0 auto; width: 100%; max-width: var(--max-width); transition: padding .15s; background-color: var(--global-background-color); .welcome-container { display: flex; width: 100%; margin-top: 2.5rem; text-align: center; align-items: center; flex-direction: column; .title-language-container { display: flex; width: 100%; justify-content: center; h2 { margin: 0; border-bottom: 0px; margin-left: 10%; } a { margin-left: auto; img { display: inline-flex; padding-right: 10px; align-items: center; justify-content: center; height: 1.5rem; width: 1.5rem; } } } form { display: flex; width: 100%; background-color: var(--global-background-color); justify-content: center; border: none; input { display: block; width: 80%; padding: 10px 20px; border: 1px solid #CCC; border-radius: 4px; box-shadow: inset 0 1px 3px #DDD; box-sizing: border-box; background-color: #FCFCFD; color: #444; } } } .cards-container { display: grid; grid-gap: 1rem; margin: 0 auto; margin-top: 3rem; margin-bottom: 3rem; padding-right: 10%; padding-left: 10%; .card { padding: 1rem; border: 1px solid var(--card-border-color); background-color: var(--card-background-color); a { display: flex; flex-direction: column; text-decoration: none; h5 { color: var(--global-font-color); font-weight: 700; font-size: 22px; margin: 0px 0px 8px 0px; border-bottom: 0px; } p { color: var(--global-font-color); font-size: 18px; margin: 0px; margin-top: auto; text-align: inherit; } } } } .document { padding: var(--documentation-padding); } } ul.language-list { display: flex; flex-wrap: wrap; list-style: none; li { flex: 1 0 25%; list-style-type: none; max-width: 25%; a { cursor: pointer; color: var(--global-font-color); } } .selected { font-weight: bolder; } } @media (min-width: 600px) { .main-wrapper { .welcome-container { .title-language-container { h2 { margin-left: auto; } } form { input { width: 50%; } } } } .cards-container { grid-template-columns: repeat(2, 1fr); } } @media (min-width: 900px) { .cards-container { grid-template-columns: repeat(3, 1fr); } } .abstract-title { font-size: 24px; font-weight: 700; } h1, h2, h3, h4, h5, h6 { margin: 0; padding-bottom: .3rem; } h1, h2, h3, h4 { line-height: 1.3; } h1, h2 { font-weight: 900; } h1 { font-size: var(--size-750); } h2 { font-size: var(--size-600); } h3 { font-size: var(--size-550); } h4 { font-size: var(--size-500); } h5 { font-size: var(--size-400); } h6 { font-size: var(--size-300); } h2>.anchor, h3>.anchor, h4>.anchor, h5>.anchor, h6>.anchor { text-decoration: none; &:hover { text-decoration: none; } } h2>.anchor::before, h3>.anchor::before, h4>.anchor::before, h5>.anchor::before, h6>.anchor::before { visibility: hidden; margin-left: .3rem; content: "#"; color: var(--global-font-color); } h2, h3, h4, h5, h6 { border-bottom: 1px solid var(--lines-color); &:hover .anchor::before { visibility: visible; transition: visibility 0s easy 0s; } } hr { margin-top: 1rem; margin-bottom: 1rem; border: 0; border-top: 1px solid var(--lines-color); } a { text-decoration: none; color: var(--links-color); &:hover { text-decoration: underline; } } img { max-width: 100%; } .imageblock { .title { margin-top: .5rem; padding-bottom: 0; font-weight: bolder; font-style: italic; } } figcaption { font-size: var(--size-300); font-style: italic; margin-top: 1rem; } pre { border-radius: 0.25rem; font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace; background-color: var(--pre-background-color); font-size: 1rem; color: var(--pre-font-color); line-height: 1.4; margin: 0 0 24px; overflow: auto !important; padding: 1rem; margin: 0; } p { text-justify: inter-word; } b, dt, strong, th { font-weight: bolder; } dt { font-style: italic; } blockquote { padding-left: var(--size-600); border-left: 5px solid; font-style: italic; } .literalblock { margin: .75em 0; overflow: auto; .content { overflow: auto; } } /* callouts */ .conum { display: inline-block; color: #FFF !important; background-color: #000; border-radius: 100px; text-align: center; font-size: .75em; width: 1.67em; height: 1.67em; font-style: normal; font-weight: bold; } .conum[data-value] { color: #FFF !important; text-align: center; font-size: .75em; line-height: 1.67em; font-style: normal; font-weight: bold; } .conum[data-value]::after { content: attr(data-value); } .colist td { padding-top: 4px; padding-bottom: 4px; } .colist tr td b, .programlisting b { display: none; } .rouge b { display: none; } /* Tables */ table { caption { text-rendering: optimizeLegibility; text-align: left; font-weight: bolder; font-size: 1rem; } } table.tableblock { display: block; margin: auto; margin-bottom: 1.25em; max-width: 100%; border-collapse: collapse; overflow-x: auto; th { text-align: left; background-color: var(--table-header-background-color); color: var(--table-header-font-color); text-rendering: optimizeLegibility; padding: .5em .625em .625em; border: 0 solid #DEDEDE; border-width: 0 1px 1px 0; } td { text-align: left; border: 0 solid #DEDEDE; text-rendering: optimizeLegibility; line-height: 1.6; padding: .5em .625em .625em; font-size: inherit; border-width: 0 1px 1px 0; } td.icon { border: none; } td:first-of-type, th:first-of-type { border-left: none; } td:last-of-type, th:last-of-type { border-right: none; } } table.stretch { width: 100%; } /* Admonitions */ .admonitionblock { margin: 1.4rem 0; padding: 1rem; color: var(--admonition-font-color); table { table-layout: fixed; position: relative; width: 100%; tbody { tr { td.icon { position: absolute; top: 0; left: 0; line-height: 1; padding-bottom: .5rem; i { display: inline-flex; align-items: center; width: auto; background-position-x: .5em; vertical-align: initial; font-style: normal; &:after { content: attr(title); font-family: 'Inter var', sans-serif; font-weight: bolder; padding: 0 .5em; margin: -.05em; } } .icon-note::before { content: "\f05a"; color: var(--admonition-note-color); } .icon-tip::before { content: "\f0eb"; color: var(--admonition-tip-color) } .icon-warning::before { content: "\f071"; color: var(--admonition-warning-color); } .icon-caution::before { content: "\f06d"; color: var(--admonition-caution-color); } .icon-important::before { content: "\f06a"; color: var(--admonition-important-color); } } td.icon [class^="fa icon-"] { font-size: 1.2rem; cursor: default; } td.content { width: 100%; word-wrap: anywhere; .title { margin-top: 2rem; } .paragraph { padding-top: .5rem; } a { color: var(--admonition-links-color); } } } } } } .note { border-left: 5px solid var(--admonition-note-color); background-color: var(--admonition-note-background-color); } .warning { border-left: 5px solid var(--admonition-warning-color); background-color: var(--admonition-warning-background-color); } .important { border-left: 5px solid var(--admonition-important-color); background-color: var(--admonition-important-background-color); } .caution { border-left: 5px solid var(--admonition-caution-color); background-color: var(--admonition-caution-background-color); } .tip { border-left: 5px solid var(--admonition-tip-color); background-color: var(--admonition-tip-background-color); } /* Example */ .example, .exampleblock { border-left: 5px solid var(--example-block-color); padding: 1rem; background-color: var(--example-block-background-color); } .exampleblock { margin: .75rem 0; color: var(--example-block-font-color); .title { font-weight: bolder; font-family: 'Inter var', sans-serif; } .content { .literalblock { .content { background: #fefde6 !important; border: none !important; color: var(--global-font-color); } } a { color: var(--admonition-links-color); } } } .procedure { border-left: 5px solid #B3B3B3; padding: 1rem; margin-bottom: 1.4rem; } /* Misc */ .fa { font-family: FontAwesome; font-style: normal; } .listingblock { margin: .75em 0; position: relative; } +.listingblock .title { + position: absolute; + top: -1em; + left: 1em; +} + .highlight { - padding-top: 1.5rem; - padding-bottom: 1.5rem; + padding: 1.5em 2em; code { font-size: 0.75rem; - padding: inherit; + padding: 0; border-radius: inherit; background-color: transparent; color: inherit; } + + &:hover code::before { + content: attr(data-lang); + position: absolute; + top: 0.5em; + right: 3em; + } } code { font-family: "DejaVu Sans Mono", Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace; padding: .5rem; border-radius: .25rem; background-color: var(--pre-background-color); color: var(--pre-font-color); } .filename { font-weight: bolder; } details { margin: 1rem 0; summary { cursor: pointer; } } kbd { font-family: "DejaVu Sans", "DejaVu Sans Bold"; display: inline-block; color: rgba(0, 0, 0, .8); font-size: .65em; line-height: 1.45; background-color: #F7F7F7; border: 1px solid #ccc; border-radius: 3px; box-shadow: 0 1px 0 rgba(0, 0, 0, .2), 0 0 0 .1em #FFF inset; margin: 0 .15em; padding: .2em .5em; vertical-align: middle; position: relative; top: -.1em; white-space: nowrap; } .to-top { opacity: 1; visibility: visible; transition: .2s; position: fixed; bottom: 1.2rem; right: 1.5rem; z-index: 15; text-decoration: none; i { font-size: 2rem; color: var(--global-font-color); } } .copy-to-clipboard-wrapper { position: absolute; margin: 0; padding: .50rem; right: .5rem; top: 0rem; button { display: flex; flex-direction: column; border: none; cursor: pointer; align-items: center; width: 1rem; height: 1rem; background: none; &:focus { outline: none; } i { color: var(--white); } } .tooltip { visibility: hidden; opacity: 0; justify-content: center; margin-top: 1em; background-color: var(--copy-clipboard-tooltip-background-color); border-radius: .25em; padding: .5em; color: var(--white); z-index: 999; &:focus { outline: none; } } .show-tooltip { visibility: visible; opacity: 1; transition: visibility 0s easy 0s; } }