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

  • Home
  • SEARCH
  • 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 3982752
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:33:57+00:00 2026-05-20T05:33:57+00:00

As is asked and answered in this post , one can use SyntaxHighlighter for

  • 0

As is asked and answered in this post, one can use SyntaxHighlighter for pretty code listing.

With ReStructuredText, I can use raw directive as follows.

.. raw:: html

    <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js"></script>
    <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js"></script>
    <link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shCoreDefault.css"/>
    <script type="text/javascript">SyntaxHighlighter.all();</script>

I could use `SyntaxHighlighter <http://alexgorbatchev.com/SyntaxHighlighter/>`_ for highlighting source code. 

.. raw:: html

    <pre class="brush: js;">
    function helloSyntaxHighlighter()
    {
        return "hi!";
    }
    </pre>

However, I need to have code directive that I can use.

.. code:: 

    function helloSyntaxHighlighter()
    {
        return "hi!";
    }

How can I translate code directive into the following HTML code?

<pre class="brush: js;">
function helloSyntaxHighlighter()
{
    return "hi!";
}
</pre>
  • 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-05-20T05:33:58+00:00Added an answer on May 20, 2026 at 5:33 am

    There is a way I have used:

    • Install rst2pdf and pygments.

    • Then make a copy of rst2html, call it myrst2html or whatever you want.

    • In the copy, add this after the imports:

      from docutils.parsers.rst import directives 
      import rst2pdf.pygments_code_block_directive 
      directives.register_directive('code-block',
          rst2pdf.pygments_code_block_directive.code_block_directive) 
      

    And that’s it, you now have the code-block directives.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As asked and answered in this post , I need to replace '[' with
As I asked and answered in this post . I have the following example
Ok for sure this has been asked and answered already but i somehow can't
I'm sure this has already been asked and answered so I apologize in advance
Question: I have a question that is apparently not answered by this already-asked Bash
this question is an extension to a previous question i asked (and was answered).
Can I set up HTML/Email Templates in C# on ASP.NET? This question was asked
Can this ever happen ? 3 asserts, where one should activate. int nr =
I know this question has been asked and answered in several ways, but none
I found that this answer was asked and answered before VS2010 was actually released.

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.