-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
readme.html
39 lines (39 loc) · 4.17 KB
/
readme.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<h1>8fold Abbreviations for CommonMark</h1>
<p>This library is an extension for the <a rel="noopener noreferrer" target="_blank" href="https://github.com/thephpleague/commonmark">CommonMark parser</a> from the PHP League adding abbreviation syntax and rendering to Markdown.</p>
<blockquote>
<p>Warning: This text is written using that syntax enabling extension testing; therefore, it will most likely not render as intended without a rendering extension using this syntax.</p>
</blockquote>
<h2>Installation</h2>
<pre><code class="language-bash">composer require 8fold/commonmark-abbreviations
</code></pre>
<h2>Usage</h2>
<h2>2.1.0 to 3.0.0</h2>
<pre><code class="language-markdown">[.Eightfold](8fold)
</code></pre>
<p>Becomes:</p>
<pre><code class="language-html"><abbr title="Eightfold">8fold</abbr>
</code></pre>
<p>You MAY also use the syntax prior to 2.1.0.</p>
<h2>2.0.0 and before</h2>
<pre><code class="language-markdown">[.8fold](Eightfold)
</code></pre>
<p>Becomes:</p>
<pre><code class="language-html"><abbr title="Eightfold">8fold</abbr>
</code></pre>
<h2>The syntax</h2>
<p>Inspired by the link syntax - <code>[]()</code> - and the footnote syntax in the extension from MultiMarkdown - <code>[^]</code>.</p>
<p>The syntax is a square bracket followed by a period or dot: <code>[.]()</code>.</p>
<p>Just like the footnote indicates superscript, the abbreviation syntax was found to indicate shortening to more people than previously proposed options. Placing the dot inside the opening square bracket allows the abbreviation to exist next to other glyphs as opposed to forcing empty space. (A conversation in the <a rel="noopener noreferrer" target="_blank" href="https://talk.commonmark.org/t/abbreviations-and-acronyms/890">CommonMark <abbr title="Specification">Spec</abbr> board</a> was also referenced, and informative.)</p>
<p>Given the traditional use of the <code>abbr</code> tag commonly combined with the <code>title</code> attribute, the link syntax makes sense as the <code>a</code> tag combines inner text with <code>href</code> and the <code>img</code> tag uses two attributes, <code>src</code> and <code>alt</code> to be valid and accessible.</p>
<h2>Replace-all <abbr title="versus">vs.</abbr> inline</h2>
<p>We decided to go with inline, single instance over footer, replace-all.</p>
<p>Two main options exist for implementing this capability.</p>
<p>The first is to place the abbreviation and definition at the bottom of the document and render all occurrences of the abbreviation with the <code>abbr</code> element and title. The drawback here is possible impact to readers using <abbr title="Assistive Technology">AT</abbr> like screen readers; potentially being read the full abbreviation each time.</p>
<p>The second option is to have the abbreviation be inline with the surrounding text. The drawback here is the need to write more each time an author uses the abbreviation.</p>
<p>This library looks at Markdown as being a way of writing potentially rich-text documents first, which can be transformed into <abbr title="Hypertext Markup Language">HTML</abbr> or something else. The recommendation from the <a rel="noopener noreferrer" target="_blank" href="https://plainlanguage.gov/resources/articles/keep-it-jargon-free/"><abbr title="United States">US</abbr> Plain Language Guidelines</a> is to avoid abbreviations and acronyms in general and specifically to:</p>
<ul>
<li>Try to keep them to a maximum of two a page.</li>
<li>Use them if spelling them out would annoy your readers.</li>
<li>If you must use an abbreviation or acronym, spell it out the first time you use it. For example: <abbr title="Computer-based training">CBT</abbr>.</li>
</ul>
<p>As a document editor and author, I tend to recommend defining "first use" as "first use per section," where "section" is further defined as beginning with a header; so, if writing a 20 page document and an abbreviation is defined on page one, it's poor <abbr title="user experience">UX</abbr> to require a reader on page 20 to turn back to page one to jog their memory of the abbreviation's definition. This also speaks to the definitions being at the end of the document, similar to a glossary.</p>