
內容簡介
{eac}Doojigger Readme Extension 可載入並解析 WordPress 標準 readme 檔案,透過短代碼與嵌入網址,讓你在網站前台靈活顯示外掛或佈景主題的說明文件中的標題、段落與各區塊內容。
【主要功能】
• 以短代碼載入並顯示 readme.txt 各區塊內容
• 支援從本機、WordPress SVN 及 GitHub 載入檔案
• 可將任意檔案以程式碼區塊方式嵌入頁面
• 支援自訂快取時間與 GitHub 私有儲存庫存取
• 可翻譯或自訂標題與段落名稱的顯示文字
• 支援 Markdown 解析與程式語言語法標示
外掛標籤
開發者團隊
② 後台搜尋「{eac}Doojigger Readme Extension for WordPress」→ 直接安裝(推薦)
原文外掛簡介
{eac}Readme is an {eac}Doojigger extension which loads and translates a WordPress markdown ‘readme’ file providing shortcodes and embedding URLs 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/)
[eacReadme wpsvn='/slugname/trunk/readme.txt'] # load file from WordPress SVN repository
[eacReadme github='/owner/repository/main/readme.txt'] # load file from a github repository
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
Or load the entire file as a single code block…
[eacReadme theme='/themefolder/functions.php']Code File[/eacReadme]
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]
Get a file as a code block…
[eacReadme theme='/my-child-theme/functions.js' lang='js']Code File[/eacReadme]
[eacReadme theme='/my-child-theme/style.css' lang='css']Code File[/eacReadme]
Other Options
Change the default cache time-to-live by adding to wp-config.php:
define('EAC_README_CACHE_LIFETIME',$seconds); # default: 1-day (DAY_IN_SECONDS).
Override the default cache time-to-live
[eacReadme ttl=$seconds ...] # minimum: 1-minute (MINUTE_IN_SECONDS).
Set the default GitHub access token (for private repositories):
define('GITHUB_ACCESS_TOKEN',$token);
Set/override the GitHub access token
[eacReadme token=$token ...]
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',
];
Embedding
{eac}Readme can also be used to embed URLs in a WordPress Post or Page. Simply paste the url in the Embed URL block.
Navigate to the post or page where the readme content is to be embedded.
Click the ‘+’ (Block Inserter) icon and search for “Embed” or type /embed.
Select the “Embed” block.
Paste the URL to the readme file into the provided field.
Click the “Embed” button. WordPress will automatically display the unformatted content.
The shortcut to this is to simply paste the URL at the end of the page/post where it says “Type / to choose a block”. WordPress will automatically convert your URL to an embed block.
Files can be embedded from your site, from the WordPress repository or from Github. Embedded URLs are transformed internally to the appropriate format.
From your site
https://
https://
From the WordPress Repository
https://ps.w.org/
https://plugins.svn.wordpress.org/
From a GitHub Repository
https://github.com/
https://github.com/
To load only specific sections of the readme file, append a fragment to the url:
https://
https://ps.w.org/
https://github.com/
Readme Format
{eac}Readme expects a well-formed readme.txt file that follows the WordPress readme file standard…
title
header: value
header: value
short Description
section
= sub-section =
…but supports some extensions to that standard:
Author & Author URI
Author header may be a simple name or a markdown link:
[Author](Author URI).
The Author & Author URI headers, if present, are combined as a markdown [Author](Author URI).
Homepage
Looks for Homepage or Plugin URI.
Version
Looks for Version or Stable tag.
Contributors
profileId – wordpress profile (standard)
[email protected] – gravatar profile
profileId@wordpress – wordpress profile
profileId@gravatar – gravatar profile
profileId@github – github profile
[display name](mailto:[email protected]) or [display name](http://www.gravatar.com/profileId/)
[display name](https://profiles.wordpress.org/profileId/)
[your name]((http://your/profile/url)
A “banner” section may be included between the top title line and the first header line.
title
[](//link_url)
header: value
header: value
short Description
section
= sub-section =
The header block may be enclosed in an html
Note: these extensions are not supported by the WordPress Plugin Repository.
{eac}Readme supports standard markdown (readme.md) formatting for section identification.
+ === title === and ## title are equivalent
+ == section == and ### section are equivalent
+ = sub-section = and #### sub-section are equivalent
Output HTML
When retrieving the header block with …
[eacReadme]All Headers[/eacReadme] or `\eacParseReadme::getAllHeaders()`
Or when retrieving all sections with …
[eacReadme]All Sections[/eacReadme] or `\eacParseReadme::getAllSections()`
Or when retrieving the entire document with …
[eacReadme]Document[/eacReadme] or `\eacParseReadme::getDocument()`
Additional html tags and classes are added, including wrapping blocks within a
