diff --git a/README.md b/README.md index 321168d..e87efbf 100644 --- a/README.md +++ b/README.md @@ -50,9 +50,8 @@ npm install express-session npm install mysql npm install sanitizer npm install promise -npm install markdown -npm install markdown-to-html -g npm install highlight npm install crypto npm install express-force-ssl +npm install remarkable ``` diff --git a/entries/projects/ackermann-function-written-in-java.md b/entries/projects/ackermann-function-written-in-java.md index 21e7df0..de91816 100644 --- a/entries/projects/ackermann-function-written-in-java.md +++ b/entries/projects/ackermann-function-written-in-java.md @@ -1,82 +1,45 @@ -\`\`\` - +``` class Ackermann_function - - { - +{     public static void main(String[] args) -     { -         //prints intro         System.out.println("This program will solve for all values in ackermann function using recursion.1"); -        System.out.println("\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*n"); - + System.out.println("**************************n")         //calls for all values of ackerman using for loop - -  - -        for(int i = 0; i \< 6; i ++) - +        for(int i = 0; i < 6; i ++)         { - -            for(int j = 0; j \< 10; j ++) - +            for(int j = 0; j < 10; j ++)             { -                 System.out.println("Ackerman (" + i + "," + j + ") is: " + ack(i,j)); -             } - -  -         }         //test sinlge -         //System.out.println(ack(3,1)); -     }     public static int ack(int m, int n) -     { -         if(m == 0) -         { -             return(n + 1); -         } - -        else if(m \> 0 && n == 0) - +        else if(m > 0 && n == 0)         { -             return(ack(m-1,1)); -         } - -        else if(m\>0 && n \> 0); - +        else if(m >0 && n > 0);         { -             return(ack(m-1, ack(m,n-1))); -         } -     } - -  - - } - -\`\`\` +} +``` The Ackermann function is a classic example of a function that is not primitive recursive – you cannot solve it using loops like Fibonacci. In other words, you diff --git a/entries/projects/batch-minecraft-launcher-with-auto-restart.md b/entries/projects/batch-minecraft-launcher-with-auto-restart.md index 745784e..33eeaf4 100644 --- a/entries/projects/batch-minecraft-launcher-with-auto-restart.md +++ b/entries/projects/batch-minecraft-launcher-with-auto-restart.md @@ -1,6 +1,6 @@ -\`\`\` +``` -\@echo off +@echo off color a @@ -24,7 +24,7 @@ ping 127.0.0.1 -n 5 goto startServer -\`\`\` +``` This batch script great for Minecraft servers which frequently crash – for whatever reason. If you want to learn more about how this script works I would diff --git a/entries/projects/java-fibonacci-solve.md b/entries/projects/java-fibonacci-solver.md similarity index 89% rename from entries/projects/java-fibonacci-solve.md rename to entries/projects/java-fibonacci-solver.md index 1ec40a4..f4655a2 100644 --- a/entries/projects/java-fibonacci-solve.md +++ b/entries/projects/java-fibonacci-solver.md @@ -7,47 +7,30 @@ Ex: |---|---|---|---|---|---|---| | x | 1 | 1 | 2 | 3 | 5 | 8 | -\`\`\` -class Fibonacci +``` +class Fibonacci { -    public static void main(String[] args) -    { - -       for(int i = 1; i \< 60; i ++) - +       for(int i = 1; i < 60; i ++)        { -                System.out.println("Fibonacci " + i + " is: t" + fib(i)); -        } -    } -//recursive definition of bibonacci - + //recursive definition of Fibonacci    public static double fib(int n) -    { -        if(n == 1 \|\| n == 2) -        { -            return(1); -        } -        return(fib(n -1) + fib(n -2)); -    } - } - -\`\`\` +``` ![](media/088cc48e754c1b99e0fcd5a5eddb9d64.png) diff --git a/entries/projects/musical-floppy-drives.md b/entries/projects/musical-floppy-drives.md index 1b3a19b..b14b465 100644 --- a/entries/projects/musical-floppy-drives.md +++ b/entries/projects/musical-floppy-drives.md @@ -1,3 +1,5 @@ -![video]() + + + A more detailed description of how I made this will be coming soon. diff --git a/entries/projects/timelapse-programming-pong.md b/entries/projects/timelapse-programming-pong.md index 6dd0596..28e2756 100644 --- a/entries/projects/timelapse-programming-pong.md +++ b/entries/projects/timelapse-programming-pong.md @@ -1,15 +1,15 @@ -![video](https://youtu.be/5OZfKYzYHPM) + Downloads: [Demo Source Code](http://jrtechs.net/download/180/) -![A screenshot of a computer screen Description generated with very high confidence](media/ad84021445feb7021f2320f6be599ef5.png) +![](media/ad84021445feb7021f2320f6be599ef5.png) [Extreme VB Pong](http://jrtechs.net/download/70/) -![A picture containing screenshot Description generated with high confidence](media/fc0a0ddf2a914b171bb3a5013e9e7b6c.png) +![](media/fc0a0ddf2a914b171bb3a5013e9e7b6c.png) [Extreme VB Pong Source Code](http://jrtechs.net/download/182/) -![A screenshot of a computer screen Description generated with very high confidence](media/13f1d6d93532bfb23a03a9a4fec5f41b.png) +![](media/13f1d6d93532bfb23a03a9a4fec5f41b.png) diff --git a/entries/projects/timelapse-programming-zombie-game.md b/entries/projects/timelapse-programming-zombie-game.md index d9a1aeb..ea8b84f 100644 --- a/entries/projects/timelapse-programming-zombie-game.md +++ b/entries/projects/timelapse-programming-zombie-game.md @@ -1,4 +1,4 @@ -![video](https://www.youtube.com/watch?v=KC9zrgMt1FA) + This is a simple zombie shooter game that I made in visual basics. The graphics are very basic due to copyrights that I wanted to avoid – and lack of artistic @@ -11,10 +11,10 @@ from the YouTube Audio Library. Downloads: -![A screenshot of a computer Description generated with very high confidence](media/d3f05acc1973ea938920407511c28bff.png) +![](media/d3f05acc1973ea938920407511c28bff.png) [Zombie Game YouTube demo](http://jrtechs.net/download/214/) -![A screenshot of a computer Description generated with very high confidence](media/09d34d523359111041accf89c82fd6c2.png) +![](media/09d34d523359111041accf89c82fd6c2.png) [Demo source code](http://jrtechs.net/download/211/) diff --git a/posts/singlePost.js b/posts/singlePost.js index 22e4f6b..e29d7d5 100644 --- a/posts/singlePost.js +++ b/posts/singlePost.js @@ -6,6 +6,27 @@ var markdown = require( "markdown" ).markdown; const sql = require('../utils/sql'); +var Remarkable = require('remarkable'); +var hljs = require('highlight.js') // https://highlightjs.org/ + +// Actual default values +var md = new Remarkable({ + html: true, + highlight: function (str, lang) { + if (lang && hljs.getLanguage(lang)) { + try { + return hljs.highlight(lang, str).value; + } catch (err) {} + } + + try { + return hljs.highlightAuto(str).value; + } catch (err) {} + + return ''; // use external default escaping + } +}); + module.exports= { @@ -35,19 +56,19 @@ module.exports= html +=""; html += "
"; - try { sql.getCategory(post.category_id).then(function(category) { var pathName = "entries/" + category[0].url + "/" + post.url + ".md"; - html += markdown.toHTML(utils.getFileContents(pathName).toString()); + var markDown = utils.getFileContents(pathName).toString(); + markDown = markDown.split("![](media/").join("![](" + "../entries/" + category[0].url + "/media/"); + html += md.render(markDown); - html = html.split("").join("
");
-                    html = html.split("").join("
"); - html = html.split("\\`\\`\\`").join("```"); - html = html.split("![](media/").join("![](" + "entries/" + category.url + "/media/"); + html = html.split("