Markdown: justify text of a post

  • Unknown's avatar

    I wonder if there’s a way to justify the text of posts written in Markdown. I’m not able to do it.

    Thanks in advance!

    Daniel

    The blog I need help with is: (visible only to logged in users)

  • Unknown's avatar

    Hello!

    It appears that there is no known way to use markdown to create justifications.
    However, you can see the WordPress Markdown guide here: http://en.support.wordpress.com/markdown/

    It appears your best option is to use justify in either the text mode or visual editor mode.

    See support post here: http://translate.google.com/translate?hl=en&sl=es&u=http://es.forums.wordpress.com/topic/justificar-texto-con-markdown&prev=search

  • Unknown's avatar
  • Unknown's avatar
  • Unknown's avatar

    Thanks, @pcosta88 and @galois.

    Well, I wish there was a way to do it, but it seems that I’m unlucky this time.

    But… maybe someone knows of a trick to do this.

  • Unknown's avatar

    I think there’s no way to do that. But you can buy CSS customization feature to do this. I use these script:

    div p {
    text-align: justify;
    text-justify: inter-word;
    }

  • Unknown's avatar

    The markdown flavor WordPress.com uses doesn’t a justify text alignment option, in fact, I think most don’t have it.

    Another way to get around would be to use HTML like so:

    <p style='text-align: justify;'>I will be justified.</p>

  • Unknown's avatar

    Hi @remehtemehmedia. Thanks for the tip. I’ll consider your recommendation.

    And thanks @designsimply too. It would be awesome if one can mix that HTML tag with Markdown here in WordPress, but I’m afraid it’s not possible.

    And I’m not sure why it’s the case, because I know it is possible to mix other HTML tags with Markdown code in a post, and the WP parser seems to be fine with that.

    So, I don’t know if the parser does something that it’s not intended to (understand some HTML tags + Markdown mixing) or it fails to recognize the <p style …> when it is supposed to do it…

    PS: thanks to everyone who is trying to help me. You’re very kind.

  • Unknown's avatar

    It would be awesome if one can mix that HTML tag with Markdown here in WordPress, but I’m afraid it’s not possible.

    That should be possible. Did you try while using the Text tab in the editor? Could you have had a syntax mistake when you tried it before?

    Give it another try. If you’re still having trouble, post an example in a reply here with some of the content you tried, including markdown and HTML, and I will try it too to see if I can find out more.

  • Unknown's avatar

    Hi @designsimply. Yep, I’ve tried using that editor.

    For example, if I try this in the text editor…

    # header 1
    
    ## header 2
    
    Hola
    
    - *hello*
    - **bonjour**
    
    <p style='text-align: justify;'>Lorem **ipsum** dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque *penatibus* et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.</p>

    …I get the first part formatted as expected.

    Then, the Markdown code (I kept it simple just using the syntax for bold and italic) that’s inside the «p style…» doesn’t work.

    When published, that paragraph gets justified, but WordPress doesn’t recognize the Markdown code that’s written on it, rendering **ipsum** and *penatibus* just like that, not as ipsum and penatibus.

    Thanks for the help and happy holidays!

  • Unknown's avatar

    Thanks for including an example.

    I researched this a bit more and found that wrapping Markdown-formatted content inside HTML block elements was not a possibility in plain Markdown in the past. However, I know that WordPress.com uses Markdown Extra by Michel Fortin, and the documentation does seem to imply we should be able to get it to work: https://michelf.ca/projects/php-markdown/extra/#markdown-attr

    I tested your snippet with markdown=”1″ per the instructions in the link above, but it didn’t work. So you are right! I submitted a bug report to see if it’s something a developer can take a look at, but I am afraid it’s not a very common request and so I’m not sure if/how soon someone will have a chance to have a look. But I did submit a request, and someone will reply here if it does get an update.

    Aside: I noticed that Markdown works properly if it is inside a span tag instead of a div, but that won’t work either in this case because “text-align” specifically only applies to block elements. Ha! That’s a perfect storm of things that won’t work together! :)

    <span style="text-align: justify;>Lorem **ipsum** dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque *penatibus* et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.</span>

    If you had the CSS Editor that comes with a Premium Plan, then you could do something like this:

    <span class="justify">Lorem **ipsum** dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque *penatibus* et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim.</span>

    And add this to your custom CSS:

    .justify {
    	display: block;
    }

    That’s really the only possible workaround I could find for the current state of things. Fun to research though. I really like Markdown. :)

  • Unknown's avatar

    You’re very kind, @designsimply. Thanks for submitting the request and helping me!

    I wish there was a workaround to the CSS alternative. I would like to have the chance to use Markdown to write, for example, footnotes and make abbreviations easily… and be able to justify the text of the post, ha ha.

    Thanks, again, @designsimply. You’re great :)

  • Unknown's avatar
  • The topic ‘Markdown: justify text of a post’ is closed to new replies.