Changeset 2319715
- Timestamp:
- 06/07/2020 07:52:48 AM (6 years ago)
- Location:
- documents-from-git/trunk
- Files:
-
- 3 edited
-
documents-git.php (modified) (1 diff)
-
includes/providers/class-base-loader.php (modified) (4 diffs)
-
readme.txt (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
documents-from-git/trunk/documents-git.php
r2274818 r2319715 4 4 * Plugin URI: https://github.com/gis-ops/wordpress-markdown-git 5 5 * Description: Render various document formats in any post/page directly from a remote Git repository of your favorite platform via shortcodes. Currently supported: Markdown, Jupyter Notebooks. 6 * Version: 1.0. 16 * Version: 1.0.2 7 7 * Author: GIS-OPS UG 8 8 * Author URI: https://gis-ops.com -
documents-from-git/trunk/includes/providers/class-base-loader.php
r2274745 r2319715 1 1 <?php 2 3 include_once('../../documents-git.php');4 2 5 3 abstract class BaseLoader { … … 78 76 public function doJupyter($sc_attrs) 79 77 { 78 $input_url = $this->extract_attributes($sc_attrs); 79 $this->set_repo_details($input_url); 80 80 81 $get_url = $this->get_nbviewer_url(); 81 82 … … 131 132 case 401: 132 133 $raw_markdown = "# 401 - Bad credentials.\nPlease review access token for user " . $this->user; 134 break; 135 case 403: 136 $raw_markdown = "# 403 - Bad credentials.\nPlease review access token for user " . $this->user; 133 137 break; 134 138 default: … … 144 148 ) 145 149 ); 150 151 // Add the Github credentials to have high /markdown rate limits 152 $GITHUB_USER = MARKDOWNGIT_CONFIG['Github']['user']; 153 $GITHUB_TOKEN = MARKDOWNGIT_CONFIG['Github']['token']; 154 if (!empty($GITHUB_USER) or !empty($GITHUB_TOKEN)) { 155 $args['headers']['Authorization'] = 'Basic ' . base64_encode($GITHUB_USER . ':' . $GITHUB_TOKEN); 156 } 157 146 158 $response = wp_remote_post(self::$GITHUB_MARKDOWN_API, $args); 147 159 $html_body = wp_remote_retrieve_body($response); -
documents-from-git/trunk/readme.txt
r2274818 r2319715 7 7 Author: GIS-OPS UG 8 8 Requires at least: 5.0.0 9 Tested up to: 5. 3.29 Tested up to: 5.4.1 10 10 Requires PHP: 7.0 11 Stable tag: 1.0. 112 Version: 1.0. 111 Stable tag: 1.0.2 12 Version: 1.0.2 13 13 License: GPLv3 14 14 License URI: https://github.com/gis-ops/wordpress-markdown-git/blob/master/LICENSE 15 15 16 A plugin to inject files directly into a post frompopular Git platforms.17 18 Currently supported file types: Markdown .19 20 Currently supported platforms: Github, Bitbucket .16 A plugin to inject and render files in a WordPress post or page directly from most popular Git platforms. 17 18 Currently supported file types: Markdown, Jupyter notebook. 19 20 Currently supported platforms: Github, Bitbucket, Gitlab. 21 21 22 22 == Description == 23 24 Official documentation: https://github.com/gis-ops/wordpress-markdown-git 23 25 24 26 This WordPress Plugin lets you easily publish, collaborate on and version control your \[**Markdown, Jupyter notebook**\] documents directly from your favorite remote Git platform, **even if it's self-hosted**. … … 28 30 - Write documents in your favorite editor and just push to your remote repository to update your blog instantly 29 31 - Use the power of version control: publish different versions of the document in different posts, i.e. from another branch or commit than latest `master` 30 - Easy to update by external users via pull requests, minimizesthe chance of stale tutorials32 - Easy to update by your readers via pull requests, minimizing the chance of stale tutorials 31 33 32 34 The following document types are currently supported: … … 42 44 43 45 ## Usage 46 47 **Note**, this plugin uses Github's wonderful [`/markdown` API](https://developer.github.com/v3/markdown/) to render to HTML. This comes with 2 caveats: 48 49 1. Unless authenticated, the rate limit is set at 60 requests per minute. It's **strongly recommended** to create a Github access token and register it with the plugin. Then the rate limit will be set to 5000 requests per hour. See [Global attributes section](#global-attributes) for details on how to do that. 50 2. The Markdown content cannot exceed 400 KB, so roughly 400 000 characters incl whitespace. If not a monographic dissertation, this should not be an applicable limit though. 44 51 45 52 ### Shortcodes … … 101 108 You **need to** authorize via `user` and `token` if you intend to publish from a private repository. You **don't need to** authorize if the repository is open. 102 109 103 However, keep in mind that some platforms have stricter API limits for anonymous requests which are greatly extended if you provide your credentials. So even for public repos it could make sense. 110 However, keep in mind that some platforms have stricter API limits for anonymous requests which are greatly extended if you provide your credentials. So even for public repos it could make sense. And it's strongly recommended to register a Github access token regardless of the VCS hosting platform, see the [beginning of the chapter](#usage). 104 111 105 112 How to generate the `token` depends on your platform: … … 172 179 ``` 173 180 181 == Frequently Asked Questions == 182 183 = Are relative links supported? = 184 185 No, relative image links (e.g. ``) cannot be processed by this plugin. Please see the notes in the [documentation](https://github.com/gis-ops/wordpress-markdown-git#images) for ways to work around this limitation. 186 187 = Can I host the source file in a private repository? = 188 189 Yes, you can, if you provide the plugin's `config.json` with the necessary credentials for your platform (see [documentation](https://github.com/gis-ops/wordpress-markdown-git#global-attributes) for details). However, be aware that all image URLs you are referencing are openly accessible or provide the necessary authentication means. Also see [#13](https://github.com/gis-ops/wordpress-markdown-git/issues/13#issuecomment-638965192) and the [documentation](https://github.com/gis-ops/wordpress-markdown-git#images) for further details. 190 174 191 == Installation == 175 192 1. Install WP Pusher (https://wppusher.com) via ZIP and activate … … 179 196 Or directly from WordPress plugin repository. 180 197 181 Or install as ZIP from https://github.com/gis-ops/wordpress-markdown-git/archive/master.zip198 Or install the latest code as ZIP from https://github.com/gis-ops/wordpress-markdown-git/archive/master.zip 182 199 183 200 == Changelog == 201 202 = v1.0.2 = 203 * Fixed rate limiting for unauthenticated `/markdown` requests 204 * Fixed Jupyter implementation 205 184 206 = v1.0.0 = 185 207 * First version
Note: See TracChangeset
for help on using the changeset viewer.