2016-08-13 6 views
7

私は.rstファイルに非常に大きなコードブロックを持っていますが、私はそれを少し強調して太字にしたいと思います。考えてみましょうRST以下:コードブロックの一部をハイライト表示

それはHTMLに変換し
wall of text. wall of text. wall of text.wall of text. wall of text. wall of text.wall of text. wall of text. wall of text. 
wall of text. wall of text. wall of text.wall of text. wall of text. wall of text.wall of text. wall of text. wall of text. 

**Example 1: Explain showing a table scan operation**:: 

    EXPLAIN FORMAT=JSON 
    SELECT * FROM Country WHERE continent='Asia' and population > 5000000; 
    { 
    "query_block": { 
     "select_id": 1, 
     "cost_info": { 
     "query_cost": "53.80"   # This query costs 53.80 cost units 
     }, 
     "table": { 
     "table_name": "Country", 
     "access_type": "ALL",   # ALL is a table scan 
     "rows_examined_per_scan": 239, # Accessing all 239 rows in the table 
     "rows_produced_per_join": 11, 
     "filtered": "4.76", 
     "cost_info": { 
     "read_cost": "51.52", 
     "eval_cost": "2.28", 
     "prefix_cost": "53.80", 
     "data_read_per_join": "2K" 
     }, 
     "used_columns": [ 
     "Code", 
     "Name", 
     "Continent", 
     "Region", 
     "SurfaceArea", 
     "IndepYear", 
     "Population", 
     "LifeExpectancy", 
     "GNP", 
     "GNPOld", 
     "LocalName", 
     "GovernmentForm", 
     "HeadOfState", 
     "Capital", 
     "Code2" 
     ], 
     "attached_condition": "((`world`.`Country`.`Continent` = 'Asia') and (`world`.`Country`.`Population` > 5000000))" 
     } 
    } 
    } 

は、その構文(良い)デフォルトでハイライトが、私はまた、それらのコメントを持つもの(太字でなければなりません数行を指定したいのですが、おそらく

私はライン(.eg #@@)に後続の文字シーケンスを追加し、ポストパーサースクリプトを作成して、生成されたhtmlファイルを変更することを考えていました。より良い方法がありますか?

+0

あなたはそれがルビーのために書かれhttp://coderay.rubychan.de/を見て撮影したが、ものの種類は、あなたが欠けているということですがありますか? (ソースコードを入力してhtmlフォーマットで出力できますか?) –

+0

私は本当にスフィンクスが好きです。私はちょうどそれとこの1つの問題があった:) –

答えて

2

code-blockディレクティブはオプションがあります。以下では、コード内にコメント付きの行をハイライト表示します。

**Example 1: Explain showing a table scan operation** 

.. code-block:: python 
    :emphasize-lines: 7, 11, 12 

    EXPLAIN FORMAT=JSON 
    SELECT * FROM Country WHERE continent='Asia' and population > 5000000; 
    { 
    "query_block": { 
     "select_id": 1, 
     "cost_info": { 
     "query_cost": "53.80"   # This query costs 53.80 cost units 
     }, 
     "table": { 
     "table_name": "Country", 
     "access_type": "ALL",   # ALL is a table scan 
     "rows_examined_per_scan": 239, # Accessing all 239 rows in the table 
     "rows_produced_per_join": 11, 
     "filtered": "4.76", 
     "cost_info": { 
     "read_cost": "51.52", 
     "eval_cost": "2.28", 
     "prefix_cost": "53.80", 
     "data_read_per_join": "2K" 
     }, 
     "used_columns": [ 
     "Code", 
     "Name", 
     "Continent", 
     "Region", 
     "SurfaceArea", 
     "IndepYear", 
     "Population", 
     "LifeExpectancy", 
     "GNP", 
     "GNPOld", 
     "LocalName", 
     "GovernmentForm", 
     "HeadOfState", 
     "Capital", 
     "Code2" 
     ], 
     "attached_condition": "((`world`.`Country`.`Continent` = 'Asia') and (`world`.`Country`.`Population` > 5000000))" 
     } 
    } 
    } 
+0

完璧な作品。ありがとうございました! –

関連する問題