{eac}Readme loads and translates a WordPress markdown 'readme.txt' file providing shortcodes to access header lines and section blocks.
Document Header
Homepage:https://eacdoojigger.earthasylum.com/eacreadme/ Author:EarthAsylum Consulting Current Version:1.0.6 Last Updated:12-Jul-2022 Requires WordPress Version:5.5.0 Compatible up to:6.0.1 Requires {eac}Doojigger:1.1.0 Requires PHP Version:7.2 Contributors:Kevin Burkholder License:GPLv3 or later License URI:https://www.gnu.org/licenses/gpl.html Tags:readme, parser, markdown, parsedown, post from readme, code highlighting, readme.txt, shortcode, {eac}Doojigger WordPress URI:https://wordpress.org/plugins/eacreadme
Description
{eac}Readme is an {eac}Doojigger extension which loads and translates a WordPress markdown 'readme.txt' file providing shortcodes to access header lines and section blocks.
Shortcode Usage
The first used shortcode must indicate the file to load...
[eacReadme file='docfolder/readme.txt'] # file is relative to the WordPress document root folder
[eacReadme content='contentfolder/readme.txt'] # content file is relative to the WordPress content folder (wp-content/)
[eacReadme plugin='pluginfolder/readme.txt'] # plugin file is relative to the WordPress plugins folder (wp-content/plugins/)
[eacReadme theme='themefolder/readme.txt'] # theme file is relative to the WordPress themes folder (wp-content/themes/)
After which, headers and sections may be pulled from that file...
[eacReadme]All Headers[/eacReadme] # parses all header lines
[eacReadme]headerName[/eacReadme] # gets the value of the named header line
[eacReadme]All Sections[/eacReadme] # parses all section blocks
[eacReadme]sectionName[/eacReadme] # parses the content of the named section block
[eacReadme]sectionName/sub-section[/eacReadme] # parses the content of the named sub-section within section block
One shortcode can do it all...
[eacReadme plugin='pluginfolder/readme.txt']Document[/eacReadme] # loads the file and parses the entire document
Shortcode Examples
Get header values...
[eacReadme]Contributors[/eacReadme]
[eacReadme]Donate link[/eacReadme]
[eacReadme]Requires at least[/eacReadme]
[eacReadme]Stable tag[/eacReadme]
Get unnamed segments...
[eacReadme]Title[/eacReadme] # gets the '=== plugin name ===' line (before headers)
[eacReadme]Short Description[/eacReadme] # gets the short description (between headers and first section block)
Get section blocks...
[eacReadme]Description[/eacReadme]
[eacReadme]Installation[/eacReadme]
[eacReadme]Screenshots[/eacReadme]
[eacReadme]Changelog[/eacReadme]
Get multiple blocks and/or sub-sections...
[eacReadme plugin='eacReadme/readme.txt']Short Description,Description[/eacReadme]
[eacReadme plugin='eacReadme/readme.txt']Short Description,Description/Shortcode Examples[/eacReadme]
Other Options
Override option to parse markdown when retrieving a segment
[eacReadme parse='true|false' ...]
Set class='language-*' on code blocks
[eacReadme lang='php|js|css|html' ...]
Translating Header/Section Names
Translate header/section names when retrieving All Headers, All Sections, or Document
[eacReadme translate='name=newname,...']
[eacReadme translate='Requires at least=Requires WordPress Version,Screenshots=Screen Shots']
Erase default translation table
[eacReadme translate='no|none|false']
Default translation table
[
'Headers' => 'Document Header',
'Plugin URI' => 'Homepage',
'Stable tag' => 'Current Version',
'Requires at least' => 'Requires WordPress Version',
'Tested up to' => 'Compatible up to',
'Requires PHP' => 'Requires PHP Version',
'WC requires at least' => 'Requires WooCommerce',
'Requires EAC' => 'Requires {eac}Doojigger',
'Changelog' => 'Change Log',
'Screenshots' => 'Screen Shots',
];
Installation
Automatic Plugin Installation
This plugin is available from the WordPress Plugin Directory and can be installed from the the 'Plugins' page » 'Add New' and search for 'EarthAsylum'. Click the plugin's 'Install' button. Once installed, click 'Activate'.
See Managing Plugins -> Automatic Plugin Installation
Upload via WordPress Dashboard
Installation of this plugin can be managed from the WordPress Dashboard » 'Plugins' » 'Add New' page by clicking the 'Upload Plugin' button, then selecting the eacreadme.zip file from your computer.
See Managing Plugins -> Upload via WordPress Admin
Manual Plugin Installation
You can install the plugin manually by extracting the eacreadme.zip file and uploading the 'eacreadme' folder to the 'wp-content/plugins' folder on your WordPress server.
See Managing Plugins -> Manual Plugin Installation
Settings
Once installed and activated options for this extension will show in the 'General' tab of {eac}Doojigger settings.
Screen Shots
- Readme Extension
Other Notes
- {eac}Readme is an extension plugin of and requires installation and registration of {eac}Doojigger.
- {eac}Readme uses Parsedown 1.7.4, Copyright (c) 2013-2018 Emanuil Rusev
- {eac}Readme uses Prism syntax highlighter, Copyright (c) 2012 Lea Verou
Copyright
Copyright © 2019-2022, EarthAsylum Consulting, distributed under the terms of the GNU GPL.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should receive a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
Change Log
Version 1.0.6 – July 12, 2022
- Get contributor profile when getting all headers.
- Move short description before heades in getDocument().
Version 1.0.5 – June 22, 2022
- Added "{plugin}_eacReadme" filter.
- Added title attribute to nav links.
Version 1.0.4 – June 9, 2022
- Updated for {eac}Doojigger 1.1.0
Version 1.0.3 – May 12, 2022
- Added transient caching of contributor profiles.
Version 1.0.2 – May 10, 2022
- Added section name translation.
Version 1.0.1 – April 28, 2022
- Minor changes / enhancements.
Version 1.0.0 – February 26, 2022
- Initial release.
This document (and most of this site) was generated using {eac}Readme by processing the included ‘readme.txt’ file with this shortcode…
[eacReadme plugin='/eacreadme/readme.txt']document[/eacReadme]
With Prism code highlighting enabled and additional CSS styling…
/* readme content w/tabs */
#readme-head summary {
float: left;
}
#readme-head summary:after {
content: '...';
}
#readme-head p {
float: right;
font-size: .9em;
font-style: italic;
opacity: .8;
background-color: var(--eac-lighter-background);
border: .5px solid var(--eac-highlight-text);
margin-bottom: 2em;
padding: .5em;
display: grid;
grid-template-columns: max-content auto;
grid-column-gap: .5em;
}
.readme-head-name {
font-weight: 500;
}
.readme-head-value {
max-width: 26em;
}
#readme-short {
clear: both;
font-size: 1.25em;
font-weight: 400;
font-style: italic;
letter-spacing: .5px;
color: var(--eac-contrast-text);
background: var(--eac-lighter-background);
border: dotted .5px;
border-radius: 4px;
padding: 0.25em;
margin-bottom: 1.5em;
}
#readme-nav {
float: right;
padding: 0 2em;
}
#readme-content {
clear: right;
padding: 0 1em;
}
#readme-nav a {
display: inline-block;
max-width: 7em;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
margin: .25em 0 -.42em 0;
padding: .2em;
color: var(--eac-highlight-text);
background-color: var(--eac-lighter-background);
border: .5px solid var(--eac-highlight-text);
border-radius: 4px 4px 0 0;
}
#readme-nav a.readme-active {
color: var(--eac-highlight-text);
background-color: white !important;
border-bottom-color: white !important;
}
#readme-content details.readme {
display: none;
}
#readme-content details.readme summary {
display: list-item;
list-style: inside disclosure-closed;
margin: 1em 0;
font-size: 1.5em;
font-weight: bold;
border-bottom: dotted .5px;
}
#readme-content details.readme.readme-active {
display: block;
border-top: .5px solid var(--eac-highlight-text);
border-radius: 1em;
padding: 0 .5em;
overflow: auto;
}
#readme-screenshots {
font-weight: bold;
color: var(--eac-detail-text);
}
#readme-screenshots img,
#readme-other-notes img {
margin: 1em;
max-width: 95%;
display: block;
margin-left: auto;
margin-right: 0;
box-shadow: 2px 2px var(--eac-darker-background);
}
And a little JavaScript to manage the tab content…
add_action("wp_footer", function()
{
echo '<script>
jQuery("#readme-content a[href=\"#readme-top\"]").remove();
jQuery(document).ready(function () {
jQuery("nav.readme > a").click(function (e) {
jQuery(this).addClass("readme-active");
jQuery(this).siblings().removeClass("readme-active");
index = jQuery(this).index() + 1;
jQuery("#readme-content > details").removeClass("readme-active");
jQuery("#readme-content > details:nth-child(" + index + ")").addClass("readme-active");
return false;
});
jQuery("nav.readme > a:first-child()").click();
});
</script>';
}
);
Write a Reply or Comment