{"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:\/\/wordpress.org\/plugins\/documents-from-git\/","author":16762914,"comment_status":"closed","ping_status":"closed","template":"","meta":{"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":7493,"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":"\n
Official documentation: https:\/\/github.com\/gis-ops\/wordpress-markdown-git<\/p>\n\n
This WordPress Plugin lets you easily publish, collaborate on and version control your [Markdown, Jupyter notebook<\/strong>] documents directly from your favorite remote Git platform, even if it's self-hosted<\/strong>.<\/p>\n\n The advantages are:<\/p>\n\n The following document types are currently supported:<\/p>\n\n The following platforms are currently supported:<\/p>\n\n Note<\/strong>, this plugin uses Github's wonderful The plugin features a variety of shortcodes.<\/p>\n\n The document-specific shortcodes follow a pattern of Additionally, there's an enclosing shortcode Add the enclosing 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 Since most attributes will be the same across the entire system, this plugin offers the possibility to set all attributes globally except for In the menu Plugins<\/em> \u25ba Plugin Editor<\/em>, choose \"Documents from Git\" and enter your preferences in the Note<\/strong>, setting the attributes manually in the shortcode has always precedence over any settings in 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 This plugin soon offers 2 methods for caching, This is the default strategy, as it doesn't require any user action.<\/p>\n\n The property Currently there's no way to flush the cache manually. However, changing This is not implemented yet<\/strong>. See #20<\/a> for details.<\/p>\n\n You need to<\/strong> authorize via 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 caching capabilities<\/a>, it's strongly recommended to register a Github access token regardless of the VCS hosting platform, see the beginning of the chapter<\/a>.<\/p>\n\n How to generate the This plugin needs only Read access<\/strong> to your repositories. Keep that in mind when creating an access token.<\/p>\n\n We publish our own tutorials with this plugin: https:\/\/gis-ops.com\/tutorials\/.<\/p>\n\n The following example will put a dashed box around the whole post:<\/p>\n\n [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 With the following CSS file contents enqueued to your theme:<\/p>\n\n 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 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\n Directly from WordPress plugin repository.<\/p>\n\n Or the latest with WP Pusher:<\/p>\n\n Or install the latest code as ZIP from https:\/\/github.com\/gis-ops\/wordpress-markdown-git\/archive\/master.zip<\/p>\n\n\n Yes, since v2.0.0 the plugin has a subpage in the main Settings menu.<\/p><\/dd>\n Yes, since v1.1.0 the plugin supports static caching of all relevant information. See the \"Caching\" section<\/a> for details.<\/p><\/dd>\n No, relative image links (e.g. Yes, you can, if you provide the plugin's \n
master<\/code><\/li>\n\n
\n
Usage<\/h3>\n\n
\/markdown<\/code> API<\/a> to render to HTML. This comes with 2 caveats:<\/p>\n\n\n
Shortcodes<\/h3>\n\n
Publish documents<\/h4>\n\n
[git-<platform>-<action>]<\/code>, where<\/p>\n\n\n
<platform><\/code> can be one of\n\n\n
github<\/code>: if you use Github as your VCS platform<\/li>\nbitbucket<\/code>: if you use Bitbucket as your VCS platform<\/li>\ngitlab<\/code>: if you use Gitlab as your VCS platform<\/li>\n<\/ul><\/li>\n<action><\/code> can be one of\n\n\n
markdown<\/code>: Render your Markdown files hosted on your VCS platform in Github's rendering style<\/li>\njupyter<\/code>: Render your Jupyter notebook hosted on your VCS platfrom (only for public repositories<\/strong>)<\/li>\ncheckout<\/code>: Renders a small badge-like box with a link to the document and the date of the last commit<\/li>\nhistory<\/code>: Renders a <h2><\/code> section with the last commit dates, messages and authors<\/li>\n<\/ul><\/li>\n<\/ul>\n\nManipulate rendering style<\/h4>\n\n
[git-add-css]<\/code> which adds a <div id=\"git-add-css\" class=\"<classes_attribute>\"<\/code> to wrap its contents. That way you can manipulate the style freely with additional CSS classes. Follow these steps:<\/p>\n\n\n
class1<\/code>, class2<\/code>, class3<\/code><\/li>\nwp_enqueue_style('my-style', get_template_directory_uri().'\/my-style.css');<\/code> to the theme's functions.php<\/code><\/li>\ngit-add-css<\/code> shortcode to your post with the custom CSS classes in the classes<\/code> attribute, e.g.:<\/p>\n\n[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\nAttributes<\/h3>\n\n
url<\/code>\n all except 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 user<\/code>\n all except git-add-css<\/code>\n :negative_squared_cross_mark:\n :ballot_box_with_check:\n string\n The user name<\/strong> (not email) of an authorized user\n\n\n token<\/code>\n all except 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 cache_ttl<\/code>\n all except 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, only for cache_strategy=static<\/code><\/strong>.\n\n\n cache_strategy<\/code>\n all except git-add-css<\/code>\n :negative_squared_cross_mark:\n :negative_squared_cross_mark:\n integer\n Only static<\/code> caching is implemented so far. dynamic<\/code> caching is on the way!\n\n\n limit<\/code>\n 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 classes<\/code>\n 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\nGlobal attributes<\/h4>\n\n
url<\/code>:<\/p>\n\nincludes\/config.json<\/code>.<\/p>\n\nincludes\/config.json<\/code>.<\/p>\n\nCaching<\/h4>\n\n
static<\/code> and dynamic<\/code> which can be set via the cache_strategy<\/code> property.<\/p>\n\nStatic caching (cache_strategy=static<\/code>)\n\ncache_ttl<\/code> sets how many seconds<\/strong> the content cache will keep alive.<\/p>\n\ncache_ttl<\/code> or the history limit<\/code> will create a new cache.<\/p>\n\nDynamic caching (cache_strategy=dynamic<\/code>)\n\nToken<\/code> authorization<\/h4>\n\nuser<\/code> and token<\/code> if you intend to publish from a private repository. You don't need to<\/strong> authorize if the repository is open.<\/p>\n\ntoken<\/code> depends on your platform:<\/p>\n\n\n
Examples<\/h3>\n\n
Publish Markdown from Github<\/h4>\n\n
[git-github-markdown url=\"https:\/\/github.com\/gis-ops\/tutorials\/blob\/master\/qgis\/QGIS_SimplePlugin.md\"]\n<\/code><\/pre>\n\nPublish Markdown from Github with 1 hour cache<\/h4>\n\n
[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\nPublish Jupyter notebook from Github<\/h4>\n\n
[git-github-jupyter url=\"https:\/\/github.com\/GIScience\/openrouteservice-examples\/blob\/master\/python\/ortools_pubcrawl.ipynb\"]\n<\/code><\/pre>\n\nPublish from a private repository<\/h4>\n\n
[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\nDisplay last commit and document URL from Bitbucket<\/h4>\n\n
[git-bitbucket-checkout url=\"https:\/\/bitbucket.org\/nilsnolde\/test-wp-plugin\/src\/master\/README.md\"]\n<\/code><\/pre>\n\nDisplay commit history from Gitlab<\/h4>\n\n
git-gitlab-history limit=5 url=\"https:\/\/gitlab.com\/nilsnolde\/esy-osm-pbf\/-\/blob\/master\/README.md\"]\n<\/code><\/pre>\n\nUse additional CSS classes to style<\/h4>\n\n
`\n<\/code><\/pre>\n\n`css\n<\/code><\/pre>\n\n\n
\n
Does the plugin offer a UI<\/h3><\/dt>\n
Does the plugin support caching?<\/h3><\/dt>\n
Are relative links supported?<\/h3><\/dt>\n
<\/code>) cannot be processed by this plugin. Please see the notes in the documentation<\/a> for ways to work around this limitation.<\/p><\/dd>\nCan I host the source file in a private repository?<\/h3><\/dt>\n
config.json<\/code> with the necessary credentials for your platform (see 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 #13<\/a> and the documentation<\/a> for further details.<\/p><\/dd>\n\n<\/dl>\n\n\nv2.2.0<\/h4>\n\n
\n
v2.1.0<\/h4>\n\n
\n
v2.0.0<\/h4>\n\n
\n
v1.1.1<\/h4>\n\n
\n
v1.1.0<\/h4>\n\n
\n
v1.0.2<\/h4>\n\n
\n
\/markdown<\/code> requests<\/li>\nv1.0.0<\/h4>\n\n
\n