{"id":23553091,"url":"https://github.com/rhildred/editable","last_synced_at":"2025-05-15T17:30:21.193Z","repository":{"id":15490509,"uuid":"18224282","full_name":"rhildred/editable","owner":"rhildred","description":"composer installable module for editable markdown on a web page","archived":false,"fork":false,"pushed_at":"2015-01-16T03:19:20.000Z","size":268,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"gh-pages","last_synced_at":"2024-04-14T14:03:05.845Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhildred.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-28T19:39:25.000Z","updated_at":"2024-04-14T14:03:05.846Z","dependencies_parsed_at":"2022-08-30T12:12:15.253Z","dependency_job_id":null,"html_url":"https://github.com/rhildred/editable","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhildred%2Feditable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhildred%2Feditable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhildred%2Feditable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhildred%2Feditable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhildred","download_url":"https://codeload.github.com/rhildred/editable/tar.gz/refs/heads/gh-pages","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239293947,"owners_count":19615041,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-26T11:14:01.013Z","updated_at":"2025-02-17T12:42:03.738Z","avatar_url":"https://github.com/rhildred.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# editable\n\ncomposer installable module for editable markdown on a web page. There is a [partial demo here](https://rhildred.github.io/editable). To use in a project, `\"require\": {\"rhildred/editable\": \"dev-master\"}` in your composer.json file.\n\nadd an .htaccess in a folder named www in your repository:\n\n    AddHandler application/x-httpd-php .phtml\n    RewriteEngine On\n\n    RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\\2$\n    RewriteRule ^(.*)$ - [E=BASE:%1]\n\n    RewriteCond %{REQUEST_FILENAME} !-f\n    RewriteCond %{REQUEST_FILENAME}.%{TIME_YEAR}.html -f\n    # Rewrite /foo/bar to /foo/bar.html\n    RewriteRule ^(.*)$ %{REQUEST_URI}.%{TIME_YEAR}.html [L]\n\n    RewriteCond %{REQUEST_FILENAME} !-f\n    RewriteCond %{REQUEST_FILENAME}.html -f\n    # Rewrite /foo/bar to /foo/bar.html\n    RewriteRule ^(.*)$ %{REQUEST_URI}.html [L]\n\n    RewriteCond %{REQUEST_FILENAME} !-f\n    RewriteCond %{REQUEST_FILENAME}.php -f\n    # Rewrite /foo/bar to /foo/bar.php\n    RewriteRule ^(.*)$ %{REQUEST_URI}.php [L]\n\n    RewriteCond %{REQUEST_FILENAME} -d\n    RewriteCond %{REQUEST_FILENAME}index.%{TIME_YEAR}.html -f\n    # Rewrite /foo/bar to have it compiled to a new php file\n    RewriteRule ^(.*)$ %{REQUEST_URI}index.%{TIME_YEAR}.html [L]\n\n    RewriteCond %{REQUEST_FILENAME} -d\n    RewriteCond %{REQUEST_FILENAME}index.html -f\n    # Rewrite /foo/bar to have it compiled to a new php file\n    RewriteRule ^(.*)$ %{REQUEST_URI}index.html [L]\n\n    RewriteCond %{REQUEST_FILENAME} -d\n    RewriteCond %{REQUEST_FILENAME}index.php -f\n    # Rewrite /foo/bar to have it compiled to a new php file\n    RewriteRule ^(.*)$ %{REQUEST_URI}index.php [L]\n\n    RewriteCond %{REQUEST_FILENAME} !-f\n    # Rewrite /foo/bar to have it compiled to a new php file\n    RewriteRule ^(.*)$ %{ENV:BASE}indexTransform.php/$1 [L]\n\nThen you will also need some sort of routing. I added slim to my composer.json file:\n\n    \"require\":{\n        \"rhildred/editable\":\"*\",\n        \"slim/slim\": \"*\"\n    }\n    \nAlso in the www folder I added:\n\n    \u003c?php require_once(__DIR__ . '/../vendor/autoload.php');\n\n    $sScript = dirname(__FILE__) . $_SERVER['PATH_INFO'];\n    if(substr($sScript, -1) == \"/\") $sScript .= \"index\";\n    if (file_exists($sScript . \".phtml\")){\n        \\RHildred\\Editable\\Phtml::render($sScript);\n    }else{\n\n\n        session_start();\n\n        $sUrl = \"http\";\n        if(!empty($_SERVER['HTTPS']) \u0026\u0026 $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443)\n        {\n            $sUrl .= \"s\";\n        }\n        $sUrl .= \"://\" . $_SERVER[\"HTTP_HOST\"] . $_SERVER[\"REQUEST_URI\"] . \"/callback\";\n\n\n        $app = new \\Slim\\Slim();\n\n        $app-\u003eget('/login', function () use ($app){\n            global $sUrl;\n            $oOauth2 = new \\RHildred\\Editable\\Oauth2($sUrl);\n            $app-\u003eredirect($oOauth2-\u003eredirect());\n        });\n\n        $app-\u003eget('/login/callback', function () use ($app) {\n            global $sUrl;\n            $oOauth2 = new \\RHildred\\Editable\\Oauth2($sUrl);\n            $rc= $oOauth2-\u003ehandleCode($_GET[\"code\"]);\n            $_SESSION[\"currentuser\"] = $rc;\n            $app-\u003eredirect(\"../\");\n        });\n\n        $app-\u003eget('/logout', function () {\n            unset($_SESSION[\"currentuser\"]);\n            $rc = new stdClass();\n            $rc-\u003eresult = \"success\";\n            echo json_encode($rc);\n\n        });\n\n        $app-\u003eget('/CurrentUser', function () {\n            if(!isset($_SESSION[\"currentuser\"])) throw new Exception('no user logged in');\n            echo json_encode($_SESSION[\"currentuser\"]);\n        });\n\n        $app-\u003epost('/ToMd/:sId', function($sId){\n            $sReferer = !empty($_SERVER['HTTP_REFERER'])? basename($_SERVER['HTTP_REFERER']):\"index\";\n            if($sReferer == \"www\" || $sReferer == \"\" || $sReferer == \"salesucation.com\") $sReferer = \"index\";\n\n            echo \\RHildred\\Editable\\Markdown::save($sId, $_POST[\"sValue\"], $sReferer);\n        });\n\n        $app-\u003erun();\n\n    }\n    \nWhen all of this is set up, you can use the javascript from [the partial demo](https://rhildred.github.io/editable) to enable web page composition and editing with Markdown.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhildred%2Feditable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhildred%2Feditable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhildred%2Feditable/lists"}