wp-cf-readme's Introduction
# CF ReadMe The CF ReadMe plugin adds the ability to conglomerate helpful documentation in for users and retain the documentation where it belongs: with the plugin that it describes. Plugin developers can hook in the the ReadMe enqueue functions to add any content to the ReadMe page. The content is run through a Markdown filter before display, but full HTML is preserved if provided. ## Adding content Adding content to the ReadMe requires 2 functions and an Action. One function to enqueue the content for inclusion and another function to deliver the actual content for display. Below is an example of adding content: // README HANDLING add_action('admin_init','my_add_readme'); /** * Enqueue the readme function */ function my_add_readme() { if(function_exists('cfreadme_enqueue')) { cfreadme_enqueue('my-plugin','my_readme'); } } /** * return the contents of the links readme file * * @return string */ function my_readme() { $file = realpath(dirname(__FILE__)).'/README.txt'; if(is_file($file) && is_readable($file)) { $markdown = file_get_contents($file); return $markdown; } return null; } Images may be included with the plugin for display. In your readme content format the images with paths relative to the plugin's images folder, then modify the function that includes the content to pre-process the image links to accommodate the plugin location. This allows images to be delivered with the plugin and not be hard coded to a specific site. /** * return the contents of the links readme file * replace the image urls with full paths to this plugin install * * @return string */ function my_readme() { $file = realpath(dirname(__FILE__)).'/README.txt'; if(is_file($file) && is_readable($file)) { $markdown = file_get_contents($file); // process images $markdown = preg_replace('|!\[(.*?)\]\((.*?)\)|','![$1]('.WP_PLUGIN_URL.'/my-plugin/$2)',$markdown); return $markdown; } return null; } Multiple ReadMe content entries can be added by a single plugin by adding in each block of content with a unique handle. ## Introductions The ReadMe plugin will honor a .cfreadme-intro section at the top of the readme content. This allows for intro content or common instructions to be consistently displayed at the top of the readme screen. There is only one intro div and it is not dynamically populated. # My ReadMe File <div class="cfreadme-intro"> Put your intro text here </div> <!-- navigation menu will be inserted here --> --- ## Content 1 ... ## Dependencies ReadMe content can be made dependent upon other readme content being available. To add content that is dependent upon other added content, enqueue the content with that other content's handle listed as a dependency. cfreadme_enqueue('my-plugin','my_readme',array('other-plugin-handle')); With this option enabled '`my-plugin`' will not appear unless '`other-plugin-handle`' is enqueued. '`my-plugin`' will be displayed AFTER '`other-plugin-handle`' in the TOC. ## Content Formatting Conventions The plugin is designed to work with MarkDown formatted content, though it is not required. Full HTML is supported. The Plugin will build a Table of Contents based on `<h2>` elements in the page. Each content area between `<h2>` elements will be designated as a content block and shown/hidden according to click actions on the Table of Contents. The `<h2>` text is used to create the TOC link text. Content divs are automatically assigned IDs. ## Linking to ReadMe Content The plugin allows content to be directly linked to and displayed by using its ID as the URL Hash. ## Multiple ReadMe Pages TBD - not officially supported, but can be done.
wp-cf-readme's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.