feat: add github ribbon, change sample website, begin english translation.

This commit is contained in:
Nicolas Hordé 2021-01-02 12:46:21 +01:00
parent f07a0b2f9b
commit 98b6dfe500
17 changed files with 333 additions and 159 deletions

View File

@ -16,6 +16,68 @@
color: #ffffff;
}
body {
min-height: 10rem;
padding-top: 55px;
}
#forkongithub a{
box-sizing: content-box;
background:#000;
color:#fff;
text-decoration:none;
font-family:arial,sans-serif;
text-align:center;
font-weight:bold;
padding:5px 40px;
font-size:1rem;
line-height:2rem;
position:relative;
transition:0.5s;
}
#forkongithub a:hover{
background:#c11;
color:#fff;
}
#forkongithub a::before,#forkongithub a::after{
content:"";
width:100%;
display:block;
position:absolute;
top:1px;
left:0;
height:1px;
background:#fff;
}
#forkongithub a::after{
bottom:1px;
top:auto;
}
@media screen and (min-width:800px){
#forkongithub{
position:absolute;
display:block;
top:0;
right:0;
width:200px;
overflow:hidden;
height:200px;
z-index:9999;
}
#forkongithub a{
width:200px;
position:fixed;
top:60px;
right:-60px;
transform:rotate(45deg);
-webkit-transform:rotate(45deg);
-ms-transform:rotate(45deg);
-moz-transform:rotate(45deg);
-o-transform:rotate(45deg);
box-shadow:4px 4px 10px rgba(0,0,0,0.8);
}
}
blockquote
{
font-style: normal;
@ -24,7 +86,7 @@ blockquote
font-family: Consolas, "Times New Roman", Verdana;
border-left: 4px solid #CCC;
padding-left: 8px;
background: #eee;
background: #eee;
}
span.emoji-sizer
@ -156,3 +218,8 @@ flex-wrap: wrap;
{
max-width: 100%;
}
#content
{
padding-bottom: 25px;
padding-top: 10px;
}

View File

@ -10,3 +10,5 @@ define('LOG_FILE', 'log.txt');
define('ACCESS_IP', '');
define('HISTORY_FILE', 'history.txt');
define('MAX_HISTORY_FILES', 5);
define('LANGUAGE', 'en');

View File

@ -0,0 +1,8 @@
# About author
![moi](/moi.jpg?80-left)**Hordé Nicolas**
> *Passionate about computer and more particularly development. I started from a young age (17 years) in system programming. I handle about thirty programming languages among which there are many low level languages: wink:! I am also the author of MarkDoc, the Markdown-based documentation management system you are currently viewing *

View File

@ -0,0 +1,38 @@
# Dependencies
## Emoji Support
*Thanks to Cal Henderson*
* https://github.com/iamcal/js-emoji
* https://github.com/iamcal/php-emoji
* https://github.com/iamcal/emoji-data
## Converting Markdown
*Thanks to Emanuil Rusev*
* https://github.com/erusev/parsedown-extra
* https://github.com/erusev/parsedown
## Editing markdown
*Thanks to Wes Cossick*
* https://github.com/sparksuite/simplemde-markdown-editor
## Syntax highlighting
* https://github.com/PrismLibrary/Prism
## Icons
* https://github.com/FortAwesome/Font-Awesome
## Essential
* https://github.com/twbs/bootstrap
* https://github.com/jquery/jquery
* https://github.com/popperjs/popper-core
* https://github.com/zenorocha/clipboard.js
* https://github.com/codepo8/css-fork-on-github-ribbon

View File

@ -0,0 +1,20 @@
# Features
## Actual
1. Simple Website with customizables menus
2. Markdown Editor with syntax highlighting and Emoji support
3. Very fast loading with ajax support
4. Multiple websites hosting with single MarkDoc installation
3. Integrated Image viewer
4. Restricted access by ip address
5. Admin access logging
## Planned
1. Complete File Manager
2. Password protected area
3. Keeping the history of edited files and changes
4. Configuration viewer
5. Emoji menu in Markdown editor
6. Uploading multiple files by drag and drop

View File

@ -0,0 +1,25 @@
# MarkDoc
**PHP Markdown-based documentation management system, Free & OpenSource :heart_eyes: for easily create your documentation website**
This website is heavily formated with markdown format !
```
__ __ _ _____
| \/ | | | | __ \
| \ / | __ _ _ __| | _| | | | ___ ___
| |\/| |/ _` | \'__| |/ / | | |/ _ \ / __|
| | | | (_| | | | <| |__| | (_) | (__
|_| |_|\__,_|_| |_|\_\_____/ \___/ \___|
```
![gplV3](https://www.gnu.org/graphics/gplv3-127x51.png) Sous licence GPLv3 [Licence](/special/gpl-3.0.md) - *Sources downloadables on [GitHub](https://github.com/dahut87/MarkDoc)*
Based on Pheditor "PHP file editor" released under MIT license
*Specials thanks to Hamid Samak*
Made in 2020 by Nicolas H.
---
For more informations, visit the demo website running MarkDoc engine at : [https://markdoc.palon.fr](https://markdoc.palon.fr)

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@ -1,3 +1,3 @@
[Accueil](/index.md)
[Plan du site](:SITEMAP)
[Glossaire](:GLOSSAIRE)
[Home](/index.md)
[Sitemap](:SITEMAP)
[Glossary](:GLOSSAIRE)

View File

@ -0,0 +1,54 @@
# Usage
## Installation
Installation using git
```
git clone https://github.com/dahut87/MarkDoc.git [website_root]
```
Install Emoji data and copy Emoji data to the "emoji-data"
```
wget https://github.com/iamcal/emoji-data/archive/v6.0.0.zip
unzip v6.0.0.zip
mv emoji-data-v6.0.0 emoji-data
```
## Configuration
There is a sample website in the "[website_root]/hosts/locahost" directory. It's easy to add a new one, you create one subfolder by name served by your webserver.
```
[website_root]/hosts/example.com
[website_root]/hosts/test.sample.fr
```
## Configuration
The configuration file is named 'config.php', is located in the [website_root]/hosts/[host]/config.php.
List of the parameters you can modify
```
define('SUBCONTENT_DIR', 'content');
define('SHOW_HIDDEN_FILES', false);
define('VIEWABLE_FORMAT', 'md');
define('TITLE', 'Documentation');
define('ICON', 'fa-book-open');
define('ALLOWED_EXT','jpg,svg,gif,png,c,tgz,tar.gz,gz,tar,sql,ico');
define('PASSWORD', '[sha512 encoded password]');
define('LOG_FILE', 'log.txt');
define('ACCESS_IP', '');
define('HISTORY_FILE', 'history.txt');
define('MAX_HISTORY_FILES', 5);
```
**NOTE**:
There is no default password. To generate it, use the sha512sum command line like this:
```bash
user@computer:~$ echo -en "password"|sha512sum|cut -d " " -f1
b109f3bbbc244eb82441917ed06d618b9008dd09b3befd1b5e07394c706a8bb980b1d7785e5976ec049b46df5f1326af5a2ea6d103fd07c95385ffab0cacbc86
```

View File

@ -1,18 +0,0 @@
# MarkDoc
**PHP MarkDown document manager, Free &amp; OpenSource :heart_eyes: for easily create your documentation website**
```
__ __ _ _____
| \/ | | | | __ \
| \ / | __ _ _ __| | _| | | | ___ ___
| |\/| |/ _` | \'__| |/ / | | |/ _ \ / __|
| | | | (_| | | | <| |__| | (_) | (__
|_| |_|\__,_|_| |_|\_\_____/ \___/ \___|
```
![gplV3](https://www.gnu.org/graphics/gplv3-127x51.png) Sous licence GPLv3 [Licence](/special/gpl-3.0.md) - *Sources téléchargéables sur [GitHub](https://github.com/dahut87/MarkDoc)*
Based on Pheditor "PHP file editor" By Hamid Samak Release under MIT license
2020 par Nicolas H.

View File

@ -29,7 +29,7 @@ testip();
logprotect();
### Sessions
session_name('mesdocumentations');
session_name($_SERVER['SERVER_NAME']);
session_start();
/*var_dump($_POST);
@ -148,19 +148,11 @@ else
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" />
<link rel="stylesheet" type="text/css" href="/css/style.css" />
<?php print(($_SESSION['md_admin'] == true)?'<link rel="stylesheet" href="/css/codemirror.min.css" />':''); ?>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/popper.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/jstree.min.js"></script>
<script type="text/javascript" src="/js/prism.js"></script>
<script type="text/javascript" src="/js/emoji.min.js"></script>
<?php print(($_SESSION['md_admin'] == true)?'<link rel="stylesheet" href="/css/simplemde.min.css">
<script src="/js/simplemde.min.js"></script>
<script type="text/javascript" src="/js/functionsadmin.js"></script>':'<script type="text/javascript" src="/js/functions.js"></script>'); ?>
</head>
<body>
<div id="head" class="">
<nav class="navbar navbar-expand-md <?php print(($_SESSION['md_admin'] == true)?"navbar-custom":"bg-dark navbar-dark"); ?>">
<span id="forkongithub"><a href="https://github.com/dahut87/MarkDoc">Fork me on GitHub</a></span>
<nav class="navbar fixed-top navbar-expand-md <?php print(($_SESSION['md_admin'] == true)?"navbar-custom":"bg-dark navbar-dark"); ?>">
<a class="navbar-brand" href="/index.md"><i class="fas <?php echo ICON; ?>"></i>&nbsp;<?php echo TITLE; ?></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
@ -207,6 +199,7 @@ print(($_SESSION['md_admin'] == true)?'<li class="nav-item dropdown">
print($content);
?><br><br>
</div>
<div id="toc"></div>
<div id="image" class="imagepreview"><img></div><div id="editor"><textarea data-file="" class="form-control"></textarea></div>
</div>
</div>
@ -218,5 +211,14 @@ print(($_SESSION['md_admin'] == true)?'<li class="nav-item dropdown">
?>
</div>
<div class="alert"></div>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script type="text/javascript" src="/js/popper.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/jstree.min.js"></script>
<script type="text/javascript" src="/js/prism.js"></script>
<script type="text/javascript" src="/js/emoji.min.js"></script>
<?php print(($_SESSION['md_admin'] == true)?'<link rel="stylesheet" href="/css/simplemde.min.css">
<script src="/js/simplemde.min.js"></script>
<script type="text/javascript" src="/js/functionsadmin.js"></script>':'<script type="text/javascript" src="/js/functions.js"></script>'); ?>
</body>
</html>

View File

@ -28,15 +28,18 @@ $(function(){
}
}
});
emoji = new EmojiConvertor();
emoji = new EmojiConvertor();
$("#content").html(emoji.replace_colons($("#content").html()));
$("#editor").hide();
$("#image").hide();
$("#save").hide();
setTimeout(function(){ $("#forkongithub").fadeOut(1500); }, 5000);
$("#toc").tocify();
$("#files").on("select_node.jstree", function (e, nodes) {
file="/"+$("#files").jstree("get_path",nodes.node,"/").replace(/^.+?[/]/, '');
if ($("#files").jstree("is_leaf",nodes.node))
openlink(file+".md");
openlink(file+".md",false);
});
$("input[name=submit]").click(function(e) {
@ -47,21 +50,22 @@ $(function(){
majlink('head');
});
function openlink(dest)
function openlink(dest,majtree)
{
$.ajax({
type: "POST",
url: "/index.php",
data: { action: "open", file: encodeURIComponent(dest) },
success: function(data){
$("#content").html(emoji.replace_colons(data)+'<br><br>');
$("#content").html(emoji.replace_colons(data));
Prism.highlightAll();
majlink('content');
$(window).scrollTop(0);
if (majtree) searchtree(dest);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
if (dest!="special/404.md")
openlink("special/404.md");
openlink("special/404.md",false);
else
$("#content").html("<b>Erreur 404 sur erreur 404: pas de /special/404.md !");
}
@ -83,11 +87,40 @@ function majlink(context)
if (!external.test(dest) && !javascript.test(dest))
{
e.preventDefault();
openlink(dest);
openlink(dest,true);
}
});
}
function searchtree(file)
{
var flag;
$("#files").jstree("deselect_all");
node=$("#files").jstree("get_node", "ul > li:first");
file.split('/').forEach(function (item) {
flag=false;
subnodes=$("#files").jstree("get_children_dom",node);
subnodes.each(function (i,subnode)
{
text=$("#files").jstree("get_text",subnode);
if ((text==item) || (text+".md"==item))
{
$("#files").jstree("open_node",subnode);
if ($("#files").jstree("is_leaf",subnode))
{
$("#files").jstree("select_node",subnode,true);
flag=false;
return false;
}
node=subnode;
flag=true;
return false;
}
});
if (!flag) return false;
});
}
function search(arg)
{
$("#search").val(arg);
@ -96,14 +129,14 @@ function search(arg)
url: "/index.php",
data: { action: "search", search: encodeURIComponent(arg), type: "js" },
success: function(data){
$("#content").html(data+'<br><br>');
$("#content").html(data);
Prism.highlightAll();
majlink('content');
$(window).scrollTop(0);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
if (dest!="special/404.md")
openlink("special/404.md");
openlink("special/404.md",false);
else
$("#content").html("<b>Erreur 404 sur erreur 404: pas de /special/404.md !");
}

View File

@ -109,6 +109,8 @@ $(function(){
$("#editor").hide();
$("#image").hide();
$("#save").hide();
$("#content").html(emoji.replace_colons($("#content").html()));
setTimeout(function(){ $("#forkongithub").fadeOut(1500); }, 5000);
$("#files").on("ready.jstree", function (e) {
const urlParams = new URLSearchParams(window.location.search);
@ -266,7 +268,7 @@ function imagemode(dest)
function viewmode(data)
{
if (data !== undefined) {
$("#content").html(emoji.replace_colons(data)+'<br><br>');
$("#content").html(emoji.replace_colons(data));
Prism.highlightAll();
}
majlink('content');

24
lang/en.php Normal file
View File

@ -0,0 +1,24 @@
<?php
$lang['MENU'] ='Menu';
$lang['HOME'] ='Home';
$lang['GLOSSARY'] ='Glossary';
$lang['MARKDOC'] ='About MarKdoc';
$lang['ADMIN'] ='Admin';
$lang['ABOUT'] ='About...';
$lang['SEARCH' ]='Search';
$lang['VIEW'] ='View';
$lang['SAVE'] ='Save';
$lang['LOGIN'] ='Login';
$lang['NOPASS'] ='No password is given !';
$lang['ALREADYLOG'] ='You\'re already connected !';
$lang['BADPASS'] ='The password is incorrect !';
$lang['FOUND'] ='Search results</h1><p>There is %s results :';
$lang['404'] ='Error 404: file not found !';
$lang['404X2'] ='Error 404 on searching customized 404 error file !';
$lang['CONFIG'] ='Configuration';
$lang['PASSWORD'] ='Admin password';
$lang['LOGOUT'] ='Logout';
$lang['LOADING'] ='Loading...';
$lang['AJAXERROR'] ='Ajax error when loading data !';
$lang['SELECTERROR']='Error when selecting item.'
$lang['NOTCODED'] ='Fonction is not yet implemented.'

15
lang/fr.php Normal file
View File

@ -0,0 +1,15 @@
<?php
$lang['MENU'] ='Menu';
$lang['HOME'] ='Accueil';
$lang['GLOSSARY'] ='Glossaire';
$lang['MARKDOC'] ='A propos de MarKdoc';
$lang['ADMIN'] ='Admin';
$lang['ABOUT'] ='A propos';
$lang['SEARCH' ]='Rechercher';
$lang['VIEW'] ='Voir';
$lang['SAVE'] ='Sauver';
$lang['LOGIN'] ='Se connecter';
$lang['NOPASS'] ='Aucun mot de passe n\'a été saisi !';
$lang['ALREADYLOG'] ='Vous êtes déjà connecté !';
$lang['BADPASS'] ='Le mot de passe est incorrect !';
$lang['FOUND'] ='Résultats de recherche</h1><p>Il y a %s occurence(s) trouvée(s):'

View File

@ -54,7 +54,9 @@ function specialurl($url)
case ':APROPOS':
$content = '# MarkDoc
**PHP MarkDown document manager, Free &amp; OpenSource :heart_eyes: for easily create your documentation website**
**PHP Markdown-based documentation management system, Free &amp; OpenSource :heart_eyes: for easily create your documentation website**
This website is heavily formated with markdown format !
```
__ __ _ _____
| \/ | | | | __ \
@ -64,11 +66,17 @@ function specialurl($url)
|_| |_|\__,_|_| |_|\_\_____/ \___/ \___|
```
![gplV3](https://www.gnu.org/graphics/gplv3-127x51.png) Sous licence GPLv3 [Licence](/special/gpl-3.0.md) - *Sources téléchargéables sur [GitHub](https://github.com/dahut87/MarkDoc)*
![gplV3](https://www.gnu.org/graphics/gplv3-127x51.png) Sous licence GPLv3 [Licence](/special/gpl-3.0.md) - *Sources downloadables on [GitHub](https://github.com/dahut87/MarkDoc)*
Based on Pheditor "PHP file editor" By Hamid Samak Release under MIT license
Based on Pheditor "PHP file editor" released under MIT license
2020 par Nicolas H.';
*Specials thanks to Hamid Samak*
Made in 2020 by Nicolas H.
---
For more informations, visit the demo website running MarkDoc engine at : [https://markdoc.palon.fr](https://markdoc.palon.fr)';
$extra = new ParsedownExtraplus();
print($extra->text($content));
exit;

120
readme.md
View File

@ -1,6 +1,8 @@
# MarkDoc
**PHP MarkDown document manager, Free &amp; OpenSource :heart_eyes: for easily create your documentation website**
**PHP Markdown-based documentation management system, Free &amp; OpenSource :heart_eyes: for easily create your documentation website**
This website is heavily formated with markdown format !
```
__ __ _ _____
| \/ | | | | __ \
@ -10,122 +12,14 @@
|_| |_|\__,_|_| |_|\_\_____/ \___/ \___|
```
![gplV3](https://www.gnu.org/graphics/gplv3-127x51.png) Sous licence GPLv3 [Licence](/special/gpl-3.0.md) - *Sources téléchargéables sur [GitHub](https://github.com/dahut87/MarkDoc)*
![gplV3](https://www.gnu.org/graphics/gplv3-127x51.png) Sous licence GPLv3 [Licence](/special/gpl-3.0.md) - *Sources downloadables on [GitHub](https://github.com/dahut87/MarkDoc)*
Based on Pheditor "PHP file editor" By Hamid Samak Release under MIT license
Based on Pheditor "PHP file editor" released under MIT license
*Specials thanks to Hamid Samak*
2020 par Nicolas H.
Made in 2020 by Nicolas H.
---
## Features
### Actual
1. Simple Website with customizables menus
2. Markdown Editor with syntax highlighting and Emoji support
3. Very fast loading with ajax support
4. Multiple websites hosting with single MarkDoc installation
3. Integrated Image viewer
4. Restricted access by ip address
5. Admin access logging
### Planned
1. Complete File Manager
2. Password protected area
3. Keeping the history of edited files and changes
4. Configuration viewer
5. Emoji menu in Markdown editor
6. Uploading multiple files by drag and drop
## Installation
Installation using git
```
git clone https://github.com/dahut87/MarkDoc.git [website_root]
```
Install Emoji data and copy Emoji data to the "emoji-data"
```
wget https://github.com/iamcal/emoji-data/archive/v6.0.0.zip
unzip v6.0.0.zip
mv emoji-data-v6.0.0 emoji-data
```
## Usage
There is a sample website in the "[website_root]/hosts/locahost" directory. It's easy to add a new one, you create one subfolder by name served by your webserver.
```
[website_root]/hosts/example.com
[website_root]/hosts/test.sample.fr
```
## Configuration
The configuration file is named 'config.php', is located in the [website_root]/hosts/[host]/config.php.
List of the parameters you can modify
```
define('SUBCONTENT_DIR', 'content');
define('SHOW_HIDDEN_FILES', false);
define('VIEWABLE_FORMAT', 'md');
define('TITLE', 'Documentation');
define('ICON', 'fa-book-open');
define('ALLOWED_EXT','jpg,svg,gif,png,c,tgz,tar.gz,gz,tar,sql,ico');
define('PASSWORD', '[sha512 encoded password]');
define('LOG_FILE', 'log.txt');
define('ACCESS_IP', '');
define('HISTORY_FILE', 'history.txt');
define('MAX_HISTORY_FILES', 5);
```
**NOTE**:
The default password is `admin`. Please change the password after install or first login.
## Dependences
### Emoji Support
*Thanks to Cal Henderson*
* https://github.com/iamcal/js-emoji
* https://github.com/iamcal/php-emoji
* https://github.com/iamcal/emoji-data
### Converting Markdown
*Thanks to Emanuil Rusev*
* https://github.com/erusev/parsedown-extra
* https://github.com/erusev/parsedown
### Editing markdown
*Thanks to Wes Cossick*
* https://github.com/sparksuite/simplemde-markdown-editor
### Syntax highlighting
* https://github.com/PrismLibrary/Prism
### Icons
* https://github.com/FortAwesome/Font-Awesome
### Essential
* https://github.com/twbs/bootstrap
* https://github.com/jquery/jquery
* https://github.com/popperjs/popper-core
* https://github.com/zenorocha/clipboard.js
For more informations, visit the demo website running MarkDoc engine at : [https://markdoc.palon.fr](https://markdoc.palon.fr)