Question

I am converting markdown to html in pagedown editor in the following way:

<div id="question_div" class="post_text">
</div>

<script type="text/javascript">
  $(document).ready(function() {

   var q_converter = new Markdown.getSanitizingConverter();
   $("#question_div").html(q_converter.makeHtml(<?php echo json_encode($q_detail);?>));
});
</script>

This is working well. The problem is, guess the value of $q_detail is This is not **working** well. When I open the view page source page, it displays something like

$("#question_div").html(q_converter.makeHtml("This is not **working** well"));

which I guess is not SEO friendly.

How can I make it display the $q_detail like This is not <b>working</b> well outside of the <script> tag to make it more SEO friendly?

Was it helpful?

Solution

You can do that :

<?php include('Parsedown.php') ?>

<div id="question_div" class="post_text">
<?php echo $parsedown->parse($q_detail);?>
</div>

After installing Parsedown

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top