|
|
|
|
@ -472,7 +472,8 @@ sense. But hey, a test is a test./ |
|
|
|
|
|
|
|
|
|
You should see *no* table exported above. |
|
|
|
|
* Source blocks :src_block: |
|
|
|
|
** Code-fenced source blocks (default behavior) |
|
|
|
|
** Code fence :code_fence: |
|
|
|
|
*** Code-fenced source blocks (default behavior) |
|
|
|
|
:PROPERTIES: |
|
|
|
|
:EXPORT_FILE_NAME: code-fenced-src-blocks-default |
|
|
|
|
:EXPORT_DATE: 2017-07-31 |
|
|
|
|
@ -484,7 +485,7 @@ The source blocks are code-fenced by default. |
|
|
|
|
*It is necessary to set the Hugo site config variable |
|
|
|
|
=pygmentsCodeFences= to =true= for syntax highlighting to work for |
|
|
|
|
fenced code blocks.* |
|
|
|
|
** Code-fenced source blocks :code_fence: |
|
|
|
|
*** Code-fenced source blocks |
|
|
|
|
:PROPERTIES: |
|
|
|
|
:EXPORT_HUGO_CODE_FENCE: t |
|
|
|
|
:EXPORT_FILE_NAME: code-fenced-src-blocks |
|
|
|
|
@ -498,7 +499,8 @@ the =EXPORT_HUGO_CODE_FENCE= property to =t=. |
|
|
|
|
*It is necessary to set the Hugo site config variable |
|
|
|
|
=pygmentsCodeFences= to =true= for syntax highlighting to work for |
|
|
|
|
fenced code blocks.* |
|
|
|
|
** Source blocks with =highlight= shortcode :highlight:shortcode: |
|
|
|
|
** Highlight Shortcode :highlight:shortcode: |
|
|
|
|
*** Source blocks with =highlight= shortcode |
|
|
|
|
:PROPERTIES: |
|
|
|
|
:EXPORT_HUGO_CODE_FENCE: |
|
|
|
|
:EXPORT_FILE_NAME: highlight-shortcode-src-blocks |
|
|
|
|
@ -512,66 +514,66 @@ property needs to be left *empty* instead of setting to =nil=! |
|
|
|
|
:END: |
|
|
|
|
#+END_EXAMPLE |
|
|
|
|
#+INCLUDE: "./all-posts.org::#example-text-with-code-blocks" :only-contents t |
|
|
|
|
** Source blocks with line number annotation |
|
|
|
|
*** Source blocks with line number annotation |
|
|
|
|
:PROPERTIES: |
|
|
|
|
:EXPORT_FILE_NAME: source-block-with-line-numbers |
|
|
|
|
:END: |
|
|
|
|
- [[http://orgmode.org/manual/Literal-examples.html][Org reference]] |
|
|
|
|
- [[https://gohugo.io/content-management/syntax-highlighting/][Hugo =highlight= shortcode with line numbers]] |
|
|
|
|
*** Cases |
|
|
|
|
**** Cases |
|
|
|
|
:PROPERTIES: |
|
|
|
|
:CUSTOM_ID: source-block-line-number-cases |
|
|
|
|
:END: |
|
|
|
|
**** Default new line number start |
|
|
|
|
***** Org source |
|
|
|
|
***** Default new line number start |
|
|
|
|
****** Org source |
|
|
|
|
#+BEGIN_SRC org :noweb yes |
|
|
|
|
<<src-block-n-default-start>> |
|
|
|
|
#+END_SRC |
|
|
|
|
***** Output |
|
|
|
|
****** Output |
|
|
|
|
#+BEGIN_SRC org :noweb yes :exports results :results output replace :eval yes |
|
|
|
|
<<src-block-n-default-start>> |
|
|
|
|
#+END_SRC |
|
|
|
|
**** Specify new line number start |
|
|
|
|
***** Org source |
|
|
|
|
***** Specify new line number start |
|
|
|
|
****** Org source |
|
|
|
|
#+BEGIN_SRC org :noweb yes |
|
|
|
|
<<src-block-n-custom-start>> |
|
|
|
|
#+END_SRC |
|
|
|
|
***** Output |
|
|
|
|
****** Output |
|
|
|
|
#+BEGIN_SRC org :noweb yes :exports results :results output replace :eval yes |
|
|
|
|
<<src-block-n-custom-start>> |
|
|
|
|
#+END_SRC |
|
|
|
|
**** Default continued line numbers |
|
|
|
|
***** Org source |
|
|
|
|
***** Default continued line numbers |
|
|
|
|
****** Org source |
|
|
|
|
#+BEGIN_SRC org :noweb yes |
|
|
|
|
<<src-block-n-default-continue>> |
|
|
|
|
#+END_SRC |
|
|
|
|
***** Output |
|
|
|
|
****** Output |
|
|
|
|
#+BEGIN_SRC org :noweb yes :exports results :results output replace :eval yes |
|
|
|
|
<<src-block-n-default-continue>> |
|
|
|
|
#+END_SRC |
|
|
|
|
**** Specify continued line numbers jump |
|
|
|
|
***** Org source |
|
|
|
|
***** Specify continued line numbers jump |
|
|
|
|
****** Org source |
|
|
|
|
#+BEGIN_SRC org :noweb yes |
|
|
|
|
<<src-block-n-custom-continue>> |
|
|
|
|
#+END_SRC |
|
|
|
|
***** Output |
|
|
|
|
****** Output |
|
|
|
|
#+BEGIN_SRC org :noweb yes :exports results :results output replace :eval yes |
|
|
|
|
<<src-block-n-custom-continue>> |
|
|
|
|
#+END_SRC |
|
|
|
|
** Source blocks with highlighting |
|
|
|
|
*** Source blocks with highlighting |
|
|
|
|
:PROPERTIES: |
|
|
|
|
:EXPORT_FILE_NAME: source-block-with-highlighting |
|
|
|
|
:CUSTOM_ID: source-blocks-with-highlighting |
|
|
|
|
:END: |
|
|
|
|
*** Without line numbers |
|
|
|
|
**** Without line numbers |
|
|
|
|
:PROPERTIES: |
|
|
|
|
:CUSTOM_ID: source-blocks-with-highlighting-no-linenums |
|
|
|
|
:END: |
|
|
|
|
***** Org source |
|
|
|
|
****** Org source |
|
|
|
|
#+BEGIN_SRC org :noweb yes |
|
|
|
|
<<src-block-hl-without-n>> |
|
|
|
|
#+END_SRC |
|
|
|
|
***** Output |
|
|
|
|
****** Output |
|
|
|
|
#+BEGIN_SRC org :noweb yes :exports results :results output replace :eval yes |
|
|
|
|
<<src-block-hl-without-n>> |
|
|
|
|
#+END_SRC |
|
|
|
|
@ -580,7 +582,7 @@ page/container width. This could be either called a bug in Hugo, or |
|
|
|
|
the HTML limitation. |
|
|
|
|
|
|
|
|
|
A workaround is below.. *use line numbers too!*. |
|
|
|
|
*** With line numbers *not* starting from 1 |
|
|
|
|
**** With line numbers *not* starting from 1 |
|
|
|
|
:PROPERTIES: |
|
|
|
|
:CUSTOM_ID: source-blocks-with-highlighting-with-linenums-not-starting-from-1 |
|
|
|
|
:END: |
|
|
|
|
@ -594,23 +596,23 @@ in the =highlight= shortcode when line numbers are enabled). |
|
|
|
|
always with the starting line number reference of 1. That |
|
|
|
|
has no relation with the value of the line numbers |
|
|
|
|
displayed using the =-n= or =+n= switches! |
|
|
|
|
***** Org source |
|
|
|
|
****** Org source |
|
|
|
|
#+BEGIN_SRC org :noweb yes |
|
|
|
|
<<src-block-hl-with-n-not-1>> |
|
|
|
|
#+END_SRC |
|
|
|
|
***** Output |
|
|
|
|
****** Output |
|
|
|
|
#+BEGIN_SRC org :noweb yes :exports results :results output replace :eval yes |
|
|
|
|
<<src-block-hl-with-n-not-1>> |
|
|
|
|
#+END_SRC |
|
|
|
|
*** With line numbers |
|
|
|
|
**** With line numbers |
|
|
|
|
:PROPERTIES: |
|
|
|
|
:CUSTOM_ID: source-blocks-with-highlighting-with-linenums |
|
|
|
|
:END: |
|
|
|
|
***** Org source |
|
|
|
|
****** Org source |
|
|
|
|
#+BEGIN_SRC org :noweb yes |
|
|
|
|
<<src-block-hl-with-n>> |
|
|
|
|
#+END_SRC |
|
|
|
|
***** Output |
|
|
|
|
****** Output |
|
|
|
|
#+BEGIN_SRC org :noweb yes :exports results :results output replace :eval yes |
|
|
|
|
<<src-block-hl-with-n>> |
|
|
|
|
#+END_SRC |
|
|
|
|
|