avatar

Public Blog


Are you doing tests ? Ashamed of your articles ? Anyway, you can now tell if you don't want your posts to be displayed on the explore page. Go to your settings page and toggle !

Pagination


Starting to get a huge load of posts ? (I know it's not the case... No one has a huge number of posts... Yet at least) Or you simply want your blog to look cleaner... Whatever. In your settings page you can now activate and deactivate the pagination setting and define a number of article per page. Give it a try !

RSS Feed


Now all your blogs have a RSS Feed associated ! The last 15 articles you wrote will be in it ! You can see the url of your own rss feed on the settings page. There is also a button displayed on your blog profile so that your readers can subscribe and read your amazing content every time you post something new ! Isn't that great ?

Rest API and Curl


Jokingly, a friend of mine asked if he could post some articles within his terminal. Now this joke is no more a joke, even if it looks a bit more complicated. There is now a single url that allows basic Http Auth and only accept the POST method. markdownblog.com/curl/post

Here is how you can post a new article :

curl -u $username -i -X POST -H "Content-Type: application/json" -d '{"title":Title","content":Content"}' http://markdownblog.com/curl/post

Of course you'll have to enter your password. The title isn't parsed as markdown, but the content is. Just like when you write a regular article.

# -*- coding: utf-8 -*-

from datetime import datetime

from flask import g, jsonify, request
from flask_httpauth import HTTPBasicAuth

from app import app, db
from app.models import User, Post

auth = HTTPBasicAuth()

@auth.verify_password
def verify_password(username, password):
    user = db.session.query(User).filter_by(username=username).first()
    if not user or not user.check_password(password):
        return False
    g.user = user
    return True


@app.route('/curl/post', methods=['POST'])
@auth.login_required
def curl_post():
    try:
        content = request.json.get('content')
        title = request.json.get('title')
        post = Post(user=g.user, title=title, content=content, pub_date=datetime.now())
        post.save()
        return jsonify({'data': 'Posted Successfully.'})
    except:
        return jsonify({'data': 'Something Went Wrong.'})
10-02-2015 09:19 by depado

Next Updates


As you may have seen on this article, I have ideas for this blog platform. Some are easy to implement, some are not. That's why I'd like to concentrate first on some useful features and not on the backend for now.

Usage and Clarity

As you may have seen, it's not easy to write raw markdown without having a preview of what you're doing. That's why the next step should be to implement a preview thing on the new article page. This won't be as complicated as I thought. I'll add a button that splits the page in two columns, one with the editor, the other with the preview, loaded in ajax on click of the refresh button. Optionnally I'll add a keyboard binding to refresh more easily the preview. That will require a few more learning of javascript. This will of course also apply on the edit page.

Also about the editor, I'd like to fix the size of the textarea. For now you can see about 3 lines of text when landing on the edit or new article page. I'd like to make it unresizeable, and take the full height of the window. Don't know how to do so yet, but I'll look into that direction as it would improve user experience. (No I don't plan on adding a rich-text editor like TinyMCE or whatever. I don't like those)

Further Customization of UI

There is a point I like to work on, and that's the customization of the UI. A lot could be done on that point. For example, if you don't want to display your articles in bootstrap panel, or change the color of the heading, disable buttons, make some articles private... Private articles is something I'd like to work on soon. For example you could tell that this article can not be seen on your blog homepage (index). That would introduce another concept of per-article settings. I should really work on that, but that will require some time to think and mature the idea.

For people using the syntax highlighting feature, I'd also like to allow you to choose a color scheme for your entire blog. For now it uses the monokai theme. But maybe some people don't want to use that color scheme to show their code ? I don't know. That's a feature I'd like to have hehe.

New Features ?

Except the things I said above, I'd like to introduce new features like comments on articles using disqus for example.

Planned Releases

I don't know if I'll have a lot of time to work on it, even if I have the motivation. There will be an update before the end of the week, probably with the markdown preview with fixed textarea size and customization of syntax highlighter blog wide. For the rest, no idea when I'll have enough time to code hehe.


Preview Feature is live !

The preview feature is now live ! Tell me what you think of it ! It actually didn't take too long. Most of the time I spent on this was about designing the html and the ui.

$("#click-preview").click(function () {
    $.ajax({
        type : "POST",
        url : "{{ url_for('ajax_markdown_parser') }}",
        data: JSON.stringify($("#{{form.content.id}}").val(), null, '\t'),
        contentType: 'application/json',
        success: function(result) {
            $('#previewmodal').modal();
            $('#preview_title').html("<h4>" + $("#{{ form.title.id }}").val() + "</h4>");
            $("#preview_body").html(result);
        }
    });
    return false;
});
@app.route("/_parse", methods=['POST'])
def ajax_markdown_parser():
    return markdown_renderer.render(request.json)

Quick Update About Tables !

Now Tables Are Fine
Can You Actually See
What I Mean ?

Now go get some fun using tables !