Plugin Directory

Changeset 2187581


Ignore:
Timestamp:
11/07/2019 09:41:17 AM (6 years ago)
Author:
nilsnolde
Message:

v1.2.0: implement shortcode to display dashed box around post

Location:
markdown-github
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • markdown-github/trunk/css/md-github.css

    r2177428 r2187581  
    11/*From https://github.com/ghandic/nbconvert/blob/master/css/nbconvert.css*/
     2
     3div.md_dashedbox {
     4    position: relative;
     5    font-size: 0.75em;
     6    border: 3px dashed;
     7    padding: 10px;
     8    margin-bottom:15px
     9}
     10
     11div.md_dashedbox div.markdown-github {
     12  color:white;
     13  line-height: 20px;
     14  padding: 0px 5px;
     15  position: absolute;
     16  background-color: #345;
     17  top: -3px;
     18  left: -3px;
     19  text-transform:none;
     20  font-size:1em;
     21  font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
     22}
     23
    224div.markdown-github {
    325  position: relative;
  • markdown-github/trunk/md_github.php

    r2177428 r2187581  
    44Description: A plugin to inject markdown files directly into a post from Github
    55Plugin URI: https://github.com/gis-ops/md-github-wordpress
    6 Version: 1.1.0
     6Version: 1.2.0
    77Author: Nils Nolde
    88Author URI: https://gis-ops.com
     
    106106}
    107107
     108function MDGH_md_dashedbox_github($atts) {
     109    list($url, $token) = MDGH_atts_extract($atts);
     110    //get checkout lable from file URL
     111    $checkout = MDGH_md_github_checkout($atts);
     112    //get raw markdown from file URL
     113    $markdown = MDGH_get_api_response($url, $token, 'file');
     114    //generate frame with border, checkout label and markdown content
     115    $md_dashedbox = '
     116      <div class="md_dashedbox">
     117        '.$checkout.'
     118        '.$markdown.'
     119      </div>';
     120    //send back text to replace shortcode in post
     121    return $md_dashedbox;
     122}
     123
    108124function MDGH_md_github_checkout($atts) {
    109125    list($url, $token) = MDGH_atts_extract($atts);
     
    130146add_shortcode("md_github", "MDGH_md_github_handler");
    131147add_shortcode('history_github', "MDHG_md_github_history");
     148add_shortcode("md_dashedbox_github", "MDGH_md_dashedbox_github");
     149
  • markdown-github/trunk/readme.txt

    r2177428 r2187581  
    2020- Write Markdown in your favorite editor and just push to your repo to update your blog
    2121
    22 It features 3 shortcodes:
     22It features the following shortcodes:
    2323
    24241. `[md_github token=YourToken url=Github URL]`: Pulls raw HTML from the `https://api.github.com/repos/` endpoint and styles it with Github markdown CSS
    25252. `[checkout_github token=YourToken url=Github URL]`: Displays a formatted link to the repo with the date of the latest update
    26263. `[history_github token=YourToken url=Github URL]`: Displays a commit history of the last 5 commits.
     274. `[md_dashedbox_github token=YourToken url=Github URL]`: Displays GitHub markdown file similar to [nbconvert](https://github.com/ghandic/nbconvert). This shortcode is mutually exclusive with `md_github` and `checkout_github`.
    2728
    2829Github API is queried on every new load of the page, so that changes in the repository will immediately be reflected on your blog. Private authentication tokens help increasing the API limit to 5000 requests per hour (enough even for Digital Ocean blogs) and accessing private repositories.
     
    4041`[history_github token=1d6ef5ba426648ef7d2273aca2fc80787 url=https://github.com/gis-ops/tutorials/blob/master/qgis/QGIS_PluginBasics.md]`
    4142
     43`[md_dashedbox_github token=1d6ef5ba426648ef7d2273aca2fc80787 url=https://github.com/gis-ops/tutorials/blob/master/qgis/QGIS_PluginBasics.md]`
     44
    4245## Demo
    4346
     
    4548
    4649https://gis-ops.com/react-redux-leaflet-turfjs-building-a-density-based-clustering-dbscan-app-with-the-almighty-here-maps-places-api/
     50
     51https://www.beyond-storage.com/wordpress-plugin-github-markdown
    4752
    4853## Support
     
    6065
    6166== Changelog ==
     67= c1.2.0 =
     68* Add shortcode to display dashed box around post
     69
    6270= v1.1.0 =
    6371* Add shortcode to display commit history
Note: See TracChangeset for help on using the changeset viewer.