[SPARK-28752][BUILD][DOCS][FOLLOW-UP] Render examples imported from Jekyll properly via Rouge
### What changes were proposed in this pull request? This PR proposes to use Pygment compatible format by Rouge. As of https://github.com/apache/spark/pull/26521, we use Rouge instead of Pygment wrapper in Ruby. Rouge claims Pygment compatibility; and we should output as Pygment does. ```ruby Rouge::Formatters::HTMLPygments.new(formatter) ``` wraps codes with `<div class="highlight"><pre>...` properly. ### Why are the changes needed? To keep the documentation pretty and not broken. ### Does this PR introduce any user-facing change? Theoretically, no. This is rather a regression fix in documentation (that happens only by https://github.com/apache/spark/pull/26521 in master). See the malformed doc in preview - https://spark.apache.org/docs/3.0.0-preview2/sql-pyspark-pandas-with-arrow.html ### How was this patch tested? Manually built the doc. **Before:** ![Screen Shot 2020-01-13 at 10 21 28 AM](https://user-images.githubusercontent.com/6477701/72229159-ba766a80-35ef-11ea-9a5d-9583448e7c1c.png) **After:** ![Screen Shot 2020-01-13 at 10 26 33 AM](https://user-images.githubusercontent.com/6477701/72229157-b34f5c80-35ef-11ea-8b3a-492e8aa0f82a.png) Closes #27182 from HyukjinKwon/SPARK-28752-followup. Authored-by: HyukjinKwon <gurwls223@apache.org> Signed-off-by: HyukjinKwon <gurwls223@apache.org>
This commit is contained in:
parent
361583d1f5
commit
150d49372f
|
@ -54,9 +54,9 @@ module Jekyll
|
|||
puts(e.backtrace)
|
||||
exit 1
|
||||
end
|
||||
code = select_lines(code)
|
||||
code = select_lines(code).strip
|
||||
|
||||
formatter = Rouge::Formatters::HTML.new
|
||||
formatter = Rouge::Formatters::HTMLPygments.new(Rouge::Formatters::HTML.new)
|
||||
lexer = Rouge::Lexer.find(@lang)
|
||||
rendered_code = formatter.format(lexer.lex(code))
|
||||
|
||||
|
|
Loading…
Reference in a new issue