Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8930085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:48:19+00:00 2026-06-15T08:48:19+00:00

Google Code Prettify is working fine, but when I am using the Markdown content

  • 0

Google Code Prettify is working fine, but when I am using the Markdown content and show the content from the database, Prettify isn’t working properly (link of live result).

This is what I am doing:

  • Getting content with

    <textarea name="article_content" id="wmd-input" class="wmd-panel"></textarea>

  • Then store output after (I am using PDO)

    Markdown($_POST['article_content'])

But in the result, the part I wrote in the code section is working fine if I don’t use Markdown, but when I get the content from the textarea and use Markdown, it’s not working.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:48:21+00:00Added an answer on June 15, 2026 at 8:48 am

    Look at the HTML code. You missed the class="prettyprint" off the pre tag.

    <pre><code>try {
        $db-&gt;beginTransaction();
    
        $db-&gt;exec("SOME QUERY");
    
        $stmt = $db-&gt;prepare("SOME OTHER QUERY?");
        $stmt-&gt;execute(array($value));
    
        $stmt = $db-&gt;prepare("YET ANOTHER QUERY??");
        $stmt-&gt;execute(array($value2, $value3));
    
        $db-&gt;commit();
    } catch(PDOException $ex) {
        //Something went wrong rollback!
        $db-&gt;rollBack();
        echo $ex-&gt;getMessage();
    }
    </code></pre>
    

    should be

    <pre class="prettyprint"><code>try {
        $db-&gt;beginTransaction();
    
        $db-&gt;exec("SOME QUERY");
    
        $stmt = $db-&gt;prepare("SOME OTHER QUERY?");
        $stmt-&gt;execute(array($value));
    
        $stmt = $db-&gt;prepare("YET ANOTHER QUERY??");
        $stmt-&gt;execute(array($value2, $value3));
    
        $db-&gt;commit();
    } catch(PDOException $ex) {
        //Something went wrong rollback!
        $db-&gt;rollBack();
        echo $ex-&gt;getMessage();
    }
    </code></pre>
    

    To fix the problem of having <pre> auto generated, you can try this:

    $newcontent = str_replace('<pre>', '<pre class="prettyprint">', $_POST['article_content']);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have found this project http://code.google.com/p/google-code-prettify/ i've tested it and it works fine but
We are working on an extension to google-code-prettify which does the code-coloring for source-code
So I am using the google code prettifier: http://code.google.com/p/google-code-prettify/ It does something similar to
I'm using the the HTML5Shiv from google code on my site. I'm including it
I am using prettify: <pre class=prettyprint linenums> some code </pre> It works but the
I'm using Googles excellent Code Prettify and I'm quite happy with it. But: Does
for Google Prettify to display HTML code sample properly, you should replace all the
I am using google prettify to highlight code in a contenteditable pre. The contenteditable
I'm looking around this Google code link from last an hour, can't find a
I'm trying to integrate google-code-prettify to my site in order to prettify Java code.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.