{"id":118933,"date":"2020-04-03T07:21:16","date_gmt":"2020-04-03T07:21:16","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/documents-from-git\/"},"modified":"2021-10-09T16:44:18","modified_gmt":"2021-10-09T16:44:18","slug":"documents-from-git","status":"publish","type":"plugin","link":"https:\/\/szl.wordpress.org\/plugins\/documents-from-git\/","author":16762914,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"2.2.0","stable_tag":"2.2.0","tested":"5.8.13","requires":"5.0.0","requires_php":"7.0","requires_plugins":"","header_name":"Documents from Git","header_author":"GIS-OPS UG","header_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.","assets_banners_color":"601812","last_updated":"2021-10-09 16:44:18","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/github.com\/gis-ops\/wordpress-markdown-git","header_author_uri":"https:\/\/gis-ops.com","rating":5,"author_block_rating":0,"active_installs":200,"downloads":7449,"num_ratings":3,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"1.0.0":{"tag":"1.0.0","author":"nilsnolde","date":"2020-04-03 07:23:20"},"1.0.1":{"tag":"1.0.1","author":"nilsnolde","date":"2020-04-03 09:31:28"},"1.0.2":{"tag":"1.0.2","author":"nilsnolde","date":"2020-06-07 07:53:54"},"1.1.0":{"tag":"1.1.0","author":"nilsnolde","date":"2020-09-22 17:56:34"},"1.1.1":{"tag":"1.1.1","author":"nilsnolde","date":"2021-04-05 18:41:10"},"2.0.0":{"tag":"2.0.0","author":"nilsnolde","date":"2021-05-20 18:30:37"},"2.0.1":{"tag":"2.0.1","author":"nilsnolde","date":"2021-05-20 18:39:08"},"2.1.0":{"tag":"2.1.0","author":"nilsnolde","date":"2021-06-19 14:18:21"},"2.2.0":{"tag":"2.2.0","author":"nilsnolde","date":"2021-10-09 16:44:18"}},"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":3},"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":2274827,"resolution":"128x128","location":"assets","locale":""},"icon-256x256.png":{"filename":"icon-256x256.png","revision":2274827,"resolution":"256x256","location":"assets","locale":""},"icon.svg":{"filename":"icon.svg","revision":2274827,"resolution":false,"location":"assets","locale":false}},"assets_banners":{"banner-1544x500.png":{"filename":"banner-1544x500.png","revision":2274827,"resolution":"1544x500","location":"assets","locale":""},"banner-772x250.png":{"filename":"banner-772x250.png","revision":2274827,"resolution":"772x250","location":"assets","locale":""},"banner.svg":{"filename":"banner.svg","revision":2274827,"resolution":false,"location":"assets","locale":false}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.0","1.0.1","1.0.2","1.1.0","1.1.1","2.0.0","2.0.1","2.1.0","2.2.0"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[1667,1673,183839,4608,38553],"plugin_category":[],"plugin_contributors":[191125,183840],"plugin_business_model":[],"class_list":["post-118933","plugin","type-plugin","status-publish","hentry","plugin_tags-bitbucket","plugin_tags-github","plugin_tags-jupyter","plugin_tags-markdown","plugin_tags-notebook","plugin_contributors-danilopinotti","plugin_contributors-nilsnolde","plugin_committers-nilsnolde"],"banners":{"banner":"https:\/\/ps.w.org\/documents-from-git\/assets\/banner-772x250.png?rev=2274827","banner_2x":"https:\/\/ps.w.org\/documents-from-git\/assets\/banner-1544x500.png?rev=2274827","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":"https:\/\/ps.w.org\/documents-from-git\/assets\/icon.svg?rev=2274827","icon":"https:\/\/ps.w.org\/documents-from-git\/assets\/icon.svg?rev=2274827","icon_2x":false,"generated":false},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Official documentation: https:\/\/github.com\/gis-ops\/wordpress-markdown-git<\/p>\n\n<p>This WordPress Plugin lets you easily publish, collaborate on and version control your &#091;<strong>Markdown, Jupyter notebook<\/strong>&#093; documents directly from your favorite remote Git platform, <strong>even if it's self-hosted<\/strong>.<\/p>\n\n<p>The advantages are:<\/p>\n\n<ul>\n<li>Write documents in your favorite editor and just push to your remote repository to update your blog instantly<\/li>\n<li>Use the power of version control: publish different versions of the document in different posts, i.e. from another branch or commit than latest <code>master<\/code><\/li>\n<li>Easy to update by your readers via pull requests, minimizing the chance of stale tutorials<\/li>\n<\/ul>\n\n<p>The following document types are currently supported:<\/p>\n\n<ul>\n<li>Markdown<\/li>\n<li>Jupyter notebooks (<strong>only for public repositories<\/strong>)<\/li>\n<\/ul>\n\n<p>The following platforms are currently supported:<\/p>\n\n<ul>\n<li>Github<\/li>\n<li>Bitbucket<\/li>\n<li>Gitlab<\/li>\n<\/ul>\n\n<h3>Usage<\/h3>\n\n<p><strong>Note<\/strong>, this plugin uses Github's wonderful <a href=\"https:\/\/developer.github.com\/v3\/markdown\/\"><code>\/markdown<\/code> API<\/a> to render to HTML. This comes with 2 caveats:<\/p>\n\n<ol>\n<li>Unless authenticated, the rate limit is set at 60 requests per minute. Since v1.1.0 the plugin is capable of statically <a href=\"#caching\">caching content<\/a>. In case that's not dynamic enough for you, your only option currently is to not use any cache in which case every document will be pulled from your provider every time someone opens it on your site. Then it's <strong>strongly recommended<\/strong> 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 <a href=\"#global-attributes\">Global attributes section<\/a> for details on how to do that.<\/li>\n<li>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.<\/li>\n<\/ol>\n\n<h3>Shortcodes<\/h3>\n\n<p>The plugin features a variety of shortcodes.<\/p>\n\n<h4>Publish documents<\/h4>\n\n<p>The document-specific shortcodes follow a pattern of <code>[git-&lt;platform&gt;-&lt;action&gt;]<\/code>, where<\/p>\n\n<ul>\n<li><code>&lt;platform&gt;<\/code> can be one of\n\n<ul>\n<li><code>github<\/code>: if you use Github as your VCS platform<\/li>\n<li><code>bitbucket<\/code>: if you use Bitbucket as your VCS platform<\/li>\n<li><code>gitlab<\/code>: if you use Gitlab as your VCS platform<\/li>\n<\/ul><\/li>\n<li><code>&lt;action&gt;<\/code> can be one of\n\n<ul>\n<li><code>markdown<\/code>: Render your Markdown files hosted on your VCS platform in Github's rendering style<\/li>\n<li><code>jupyter<\/code>: Render your Jupyter notebook hosted on your VCS platfrom (<strong>only for public repositories<\/strong>)<\/li>\n<li><code>checkout<\/code>: Renders a small badge-like box with a link to the document and the date of the last commit<\/li>\n<li><code>history<\/code>:  Renders a <code>&lt;h2&gt;<\/code> section with the last commit dates, messages and authors<\/li>\n<\/ul><\/li>\n<\/ul>\n\n<h4>Manipulate rendering style<\/h4>\n\n<p>Additionally, there's an enclosing shortcode <code>[git-add-css]<\/code> which adds a <code>&lt;div id=\"git-add-css\" class=\"&lt;classes_attribute&gt;\"<\/code> to wrap its contents. That way you can manipulate the style freely with additional CSS classes. Follow these steps:<\/p>\n\n<ol>\n<li>Add a CSS file to your theme's root folder, which contains some classes, e.g. <code>class1<\/code>, <code>class2<\/code>, <code>class3<\/code><\/li>\n<li>Enqueue the CSS file by adding <code>wp_enqueue_style('my-style', get_template_directory_uri().'\/my-style.css');<\/code> to the theme's <code>functions.php<\/code><\/li>\n<li><p>Add the enclosing <code>git-add-css<\/code> shortcode to your post with the custom CSS classes in the <code>classes<\/code> attribute, e.g.:<\/p>\n\n<p><code>[git-add-css classes=\"class1 class2 class3\"]\n[git-gitlab-checkout url=...]\n[git-gitlab-markdown url=...]\n[git-gitlab-history url=...]\n[\/git-add-css]<\/code><\/p><\/li>\n<\/ol>\n\n<h3>Attributes<\/h3>\n\n<p>Each shortcode takes a few attributes, indicating if it's required for public or private repositories:<\/p>\n\n\n\n\n  Attribute\n  Action\n  Public repo\n  Private repo\n  Type\n  Description\n\n\n\n\n  <code>url<\/code>\n  all except <code>git-add-css<\/code>\n  :ballot_box_with_check:\n  :ballot_box_with_check:\n  string\n  The browser URL of the document, e.g. https:\/\/github.com\/gis-ops\/wordpress-markdown-git\/blob\/master\/README.md\n\n\n  <code>user<\/code>\n  all except <code>git-add-css<\/code>\n  :negative_squared_cross_mark:\n  :ballot_box_with_check:\n  string\n  The <strong>user name<\/strong> (not email) of an authorized user\n\n\n  <code>token<\/code>\n  all except <code>git-add-css<\/code>\n  :negative_squared_cross_mark:\n  :ballot_box_with_check:\n  string\n  The access token\/app password for the authorized user\n\n\n  <code>cache_ttl<\/code>\n  all except <code>git-add-css<\/code>\n  :negative_squared_cross_mark:\n  :negative_squared_cross_mark:\n  integer\n  The time in seconds that the plugin will cache, <strong>only for <code>cache_strategy=static<\/code><\/strong>.\n\n\n  <code>cache_strategy<\/code>\n  all except <code>git-add-css<\/code>\n  :negative_squared_cross_mark:\n  :negative_squared_cross_mark:\n  integer\n  Only <code>static<\/code> caching is implemented so far. <code>dynamic<\/code> caching is on the way!\n\n\n  <code>limit<\/code>\n  <code>history<\/code>\n  :negative_squared_cross_mark:\n  :negative_squared_cross_mark:\n  integer\n  Limits the history of commits to this number. Default 5.\n\n\n  <code>classes<\/code>\n  <code>git-add-css<\/code>\n  :ballot_box_with_check:\n  :ballot_box_with_check:\n  string\n  The additional CSS classes to render the content with\n\n\n\n\n<h4>Global attributes<\/h4>\n\n<p>Since most attributes will be the same across the entire system, this plugin offers the possibility to set all attributes globally except for <code>url<\/code>:<\/p>\n\n<p>In the menu <em>Plugins<\/em> \u25ba <em>Plugin Editor<\/em>, choose \"Documents from Git\" and enter your preferences in the <code>includes\/config.json<\/code>.<\/p>\n\n<p><strong>Note<\/strong>, setting the attributes manually in the shortcode has always precedence over any settings in <code>includes\/config.json<\/code>.<\/p>\n\n<h4>Caching<\/h4>\n\n<p>Often we need to prioritize speed when loading content and, in addition, it is very costly to fetch, load and format the content every time we need to read the content of the post.<\/p>\n\n<p>This plugin soon offers 2 methods for caching, <code>static<\/code> and <code>dynamic<\/code> which can be set via the <code>cache_strategy<\/code> property.<\/p>\n\nStatic caching (<code>cache_strategy=static<\/code>)\n\n<p>This is the default strategy, as it doesn't require any user action.<\/p>\n\n<p>The property <code>cache_ttl<\/code> sets how many <strong>seconds<\/strong> the content cache will keep alive.<\/p>\n\n<p>Currently there's no way to flush the cache manually. However, changing <code>cache_ttl<\/code> or the history <code>limit<\/code> will create a new cache.<\/p>\n\nDynamic caching (<code>cache_strategy=dynamic<\/code>)\n\n<p><strong>This is not implemented yet<\/strong>. See <a href=\"https:\/\/github.com\/gis-ops\/wordpress-markdown-git\/issues\/20\">#20<\/a> for details.<\/p>\n\n<h4><code>Token<\/code> authorization<\/h4>\n\n<p>You <strong>need to<\/strong> authorize via <code>user<\/code> and <code>token<\/code> if you intend to publish from a private repository. You <strong>don't need to<\/strong> authorize if the repository is open.<\/p>\n\n<p>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 unless you use this plugin's <a href=\"#caching\">caching capabilities<\/a>, it's strongly recommended to register a Github access token regardless of the VCS hosting platform, see the <a href=\"#usage\">beginning of the chapter<\/a>.<\/p>\n\n<p>How to generate the <code>token<\/code> depends on your platform:<\/p>\n\n<ul>\n<li>Github: Generate a Personal Access Token following <a href=\"https:\/\/help.github.com\/en\/github\/authenticating-to-github\/creating-a-personal-access-token-for-the-command-line\">these instructions<\/a><\/li>\n<li>Bitbucket: Generate a App Password following <a href=\"https:\/\/confluence.atlassian.com\/bitbucket\/app-passwords-828781300.html#Apppasswords-Createanapppassword\">these instructions<\/a><\/li>\n<li>Gitlab: Generate a Personal Access Token following <a href=\"https:\/\/docs.gitlab.com\/ee\/user\/profile\/personal_access_tokens.html#creating-a-personal-access-token\">these instructions<\/a><\/li>\n<\/ul>\n\n<p>This plugin needs only <strong>Read access<\/strong> to your repositories. Keep that in mind when creating an access token.<\/p>\n\n<h3>Examples<\/h3>\n\n<p>We publish our own tutorials with this plugin: https:\/\/gis-ops.com\/tutorials\/.<\/p>\n\n<h4>Publish Markdown from Github<\/h4>\n\n<pre><code>[git-github-markdown url=\"https:\/\/github.com\/gis-ops\/tutorials\/blob\/master\/qgis\/QGIS_SimplePlugin.md\"]\n<\/code><\/pre>\n\n<h4>Publish Markdown from Github with 1 hour cache<\/h4>\n\n<pre><code>[git-github-markdown url=\"https:\/\/github.com\/gis-ops\/tutorials\/blob\/master\/qgis\/QGIS_SimplePlugin.md\" cache_ttl=\"3600\" cache_strategy=\"static\"]\n<\/code><\/pre>\n\n<h4>Publish Jupyter notebook from Github<\/h4>\n\n<pre><code>[git-github-jupyter url=\"https:\/\/github.com\/GIScience\/openrouteservice-examples\/blob\/master\/python\/ortools_pubcrawl.ipynb\"]\n<\/code><\/pre>\n\n<h4>Publish from a private repository<\/h4>\n\n<pre><code>[git-bitbucket-jupyter user=nilsnolde token=3292_2p3a_84-2af url=\"https:\/\/bitbucket.org\/nilsnolde\/test-wp-plugin\/src\/master\/README.md\"]\n<\/code><\/pre>\n\n<h4>Display last commit and document URL from Bitbucket<\/h4>\n\n<pre><code>[git-bitbucket-checkout url=\"https:\/\/bitbucket.org\/nilsnolde\/test-wp-plugin\/src\/master\/README.md\"]\n<\/code><\/pre>\n\n<h4>Display commit history from Gitlab<\/h4>\n\n<pre><code>git-gitlab-history limit=5 url=\"https:\/\/gitlab.com\/nilsnolde\/esy-osm-pbf\/-\/blob\/master\/README.md\"]\n<\/code><\/pre>\n\n<h4>Use additional CSS classes to style<\/h4>\n\n<p>The following example will put a dashed box around the whole post:<\/p>\n\n<pre><code>`\n<\/code><\/pre>\n\n<p>[git-add-css classes=\"md-dashedbox\"]\n    [git-github-checkout url=\"https:\/\/github.com\/gis-ops\/tutorials\/blob\/master\/qgis\/QGIS_SimplePlugin.md\"]\n    [git-github-markdown url=\"https:\/\/github.com\/gis-ops\/tutorials\/blob\/master\/qgis\/QGIS_SimplePlugin.md\"]\n    [git-github-history url=\"https:\/\/github.com\/gis-ops\/tutorials\/blob\/master\/qgis\/QGIS_SimplePlugin.md\"]\n[\/git-add-css]\n    `<\/p>\n\n<p>With the following CSS file contents enqueued to your theme:<\/p>\n\n<pre><code>`css\n<\/code><\/pre>\n\n<p>div.md_dashedbox {\n    position: relative;\n    font-size: 0.75em;\n    border: 3px dashed;\n    padding: 10px;\n    margin-bottom:15px\n}<\/p>\n\n<p>div.md_dashedbox div.markdown-github {\n    color:white;\n    line-height: 20px;\n    padding: 0px 5px;\n    position: absolute;\n    background-color: #345;\n    top: -3px;\n    left: -3px;\n    text-transform:none;\n    font-size:1em;\n    font-family: \"Helvetica Neue\",Helvetica,Arial,sans-serif;\n}\n    `<\/p>\n\n<!--section=installation-->\n<p>Directly from WordPress plugin repository.<\/p>\n\n<p>Or the latest with WP Pusher:<\/p>\n\n<ol>\n<li>Install WP Pusher (https:\/\/wppusher.com) via ZIP and activate<\/li>\n<li>Install from Github via WP Pusher from gis-ops\/wordpress-markdown-git<\/li>\n<li>Activate and add shortcode to your posts.<\/li>\n<\/ol>\n\n<p>Or install the latest code as ZIP from https:\/\/github.com\/gis-ops\/wordpress-markdown-git\/archive\/master.zip<\/p>\n\n<!--section=faq-->\n<dl>\n<dt id='does%20the%20plugin%20offer%20a%20ui'><h3>Does the plugin offer a UI<\/h3><\/dt>\n<dd><p>Yes, since v2.0.0 the plugin has a subpage in the main Settings menu.<\/p><\/dd>\n<dt id='does%20the%20plugin%20support%20caching%3F'><h3>Does the plugin support caching?<\/h3><\/dt>\n<dd><p>Yes, since v1.1.0 the plugin supports static caching of all relevant information. See the <a href=\"https:\/\/github.com\/gis-ops\/wordpress-markdown-git#caching\">\"Caching\" section<\/a> for details.<\/p><\/dd>\n<dt id='are%20relative%20links%20supported%3F'><h3>Are relative links supported?<\/h3><\/dt>\n<dd><p>No, relative image links (e.g. <code>![img](.\/img.png)<\/code>) cannot be processed by this plugin. Please see the notes in the <a href=\"https:\/\/github.com\/gis-ops\/wordpress-markdown-git#images\">documentation<\/a> for ways to work around this limitation.<\/p><\/dd>\n<dt id='can%20i%20host%20the%20source%20file%20in%20a%20private%20repository%3F'><h3>Can I host the source file in a private repository?<\/h3><\/dt>\n<dd><p>Yes, you can, if you provide the plugin's <code>config.json<\/code> with the necessary credentials for your platform (see <a href=\"https:\/\/github.com\/gis-ops\/wordpress-markdown-git#global-attributes\">documentation<\/a> for details). However, be aware that all image URLs you are referencing are openly accessible or provide the necessary authentication means. Also see <a href=\"https:\/\/github.com\/gis-ops\/wordpress-markdown-git\/issues\/13#issuecomment-638965192\">#13<\/a> and the <a href=\"https:\/\/github.com\/gis-ops\/wordpress-markdown-git#images\">documentation<\/a> for further details.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>v2.2.0<\/h4>\n\n<ul>\n<li>plugin didn't authenticate correctly to Github<\/li>\n<\/ul>\n\n<h4>v2.1.0<\/h4>\n\n<ul>\n<li>styles were not enqueued properly which led to default markdown rendering<\/li>\n<\/ul>\n\n<h4>v2.0.0<\/h4>\n\n<ul>\n<li>created Settings subpage for the plugin (BREAKING CHANGE)<\/li>\n<\/ul>\n\n<h4>v1.1.1<\/h4>\n\n<ul>\n<li>fix Gitlab URLs for subdirectory markdown paths<\/li>\n<\/ul>\n\n<h4>v1.1.0<\/h4>\n\n<ul>\n<li>implement static caching<\/li>\n<\/ul>\n\n<h4>v1.0.2<\/h4>\n\n<ul>\n<li>Fixed rate limiting for unauthenticated <code>\/markdown<\/code> requests<\/li>\n<li>Fixed Jupyter implementation<\/li>\n<\/ul>\n\n<h4>v1.0.0<\/h4>\n\n<ul>\n<li>First version<\/li>\n<\/ul>","raw_excerpt":"A plugin to inject and render files in a WordPress post or page directly from most popular Git platforms. Currently supported file types: Markdown, J &hellip;","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/118933","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=118933"}],"author":[{"embeddable":true,"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/nilsnolde"}],"wp:attachment":[{"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=118933"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=118933"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=118933"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=118933"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=118933"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/szl.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=118933"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}