Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

How to make PrettyPrint work with markdown tags?

How can I make this work with markdown code tags?

Comments

  • hgtonighthgtonight ∞ · New Moderator

    Markdown supports inline html. So you should be able to use <pre class="prettyprint linenums">code here</pre> for it to work.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Attached is what mine looks like using the plugin with 2.1b2. The non-number option forces a new line to be created, so doesn't work well for in-line code.

    How can I make it so that the markdown code tags use this format?

  • hgtonighthgtonight ∞ · New Moderator

    The pre tag is block level anyway. You should use the code tag for inline code.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • How can I get the block level to work with markdown?

  • hgtonighthgtonight ∞ · New Moderator

    I am confused. You want to make pre tags be inline?

    Use CSS pre { display: inline; }

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Markdown has the two options for code formatting that I am familiar with. One is to use backtick tags, most common for inline formatting, and the second is to use 4 spaces at the beginning of a line, most common for block formatting.

    How can I get the PrettyPrint format to work when using the 4 spaces method for formatting code in markdown?

    Although I do see that vanillaforums.org seems to have some other way of differentiating as multi-line code blocks can be formatted with either 4 spaces or backtick tags. Also, the color format used here seems more appealing than the plugin.

  • @vrijvlinder Messaged me to add the following script, which mostly solves the issue.

    just add this script to your default.master.php or tpl. If it is a tpl add it between {literal}script goes here{/literal} tags.

    <script type="text/javascript"> $(document).ready(function() { $(this).find("pre").not('.prettyprint.linenums').each(function(){ $(this).addClass("prettyprint linenums"); prettyPrint(); }); }); </script>

    Attached is an image of how it looks in my 2.1b2 forum. Now, if the colors and everything could look as pretty as here in the vanillaforums.org forum...

  • I just made the multi-line code blocks as pretty as they are here by replacing the code in the /plugins/PrettyPrint/prettify/prettify.css file with the code from GooglePrettify css file used here in the forums. I have no idea what else this might affect, but no problems so far.

    The in-line text is not yet to my exacting standards, but overall I'm quite happy now with the improvements this plugin makes. Thanks, @vrijvlinder!

  • Something I did to further clean up the blocks is to remove {background-color:#ddd !important} from /forums/plugins/PrettyPrint/default.php. Again, I don't know what else this might affect, but so far the only thing it did was remove the dark grey background color that was appearing behind text in the in-line code and only text in block mode. Looks really nice now.

    The only things slightly annoying, and it's here in vanillaforums.org as well, are the extra large space that appears around the in-line code blocks and that the code lines break where the row breaks, instead of being more selective and breaking at spaces, slashes, dots, etc. But that really is getting into the perfectionist arena. Maybe I'll come back to it some day.

  • Hi, does anyone know what markdown editor is being used right now in this forum?

  • hgtonighthgtonight ∞ · New Moderator

    @sanotronics said:
    Hi, does anyone know what markdown editor is being used right now in this forum?

    Advanced Editor which ships with Vanilla 2.2. Although this specific editor is actually not the exact same editor here (since they are using the development version available on github).

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

Sign In or Register to comment.