Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

highlightCodeBlock: expose params so they can be passed to Chroma by users #85

Merged
merged 3 commits into from
Jul 25, 2022

Conversation

kisaragi-hiu
Copy link
Contributor

I'm trying to make it so that this:

#+begin_src emacs-lisp :hl_lines 1 :linenos true
(+ 1 2)
(+ 1 2)
#+end_src

#+begin_src emacs-lisp :hl_lines 2-3 :linenos false
(+ 1 2)
(+ 1 2)
(+ 1 2)
#+end_src

exports as expected in Hugo:

20220718T040849+0900

(The style being messed up is irrelavant as it's a problem in my own CSS)

This unfortunately requires that go-org passes the relevant information to highlightCodeBlock, and that's what this PR does.

This also adds support for :hl_lines to main.go and blorg.

@niklasfasching
Copy link
Owner

Thx!

Could you also add a small test for the ParseRanges function? Pretty much what's in the comment.

@kisaragi-hiu
Copy link
Contributor Author

Done!

@niklasfasching niklasfasching merged commit 9a9c046 into niklasfasching:master Jul 25, 2022
@niklasfasching
Copy link
Owner

Thx

kisaragi-hiu added a commit to kisaragi-hiu/hugo that referenced this pull request Jul 26, 2022
This requires niklasfasching/go-org#85, which
makes go-org pass the src block params (the key and values in
"#+begin_src <lang> :key val") to HighlightCodeBlock. Then the params
can be passed to Chroma after a bit of processing.

After these changes, this:

  #+begin_src emacs-lisp :hl_lines 1-3
  (+ 1 2)
  (+ 1 2)
  (+ 1 2)
  (+ 1 2)
  #+end_src

will apply the "hl" class on lines 1-3 just like

  {{< highlight emacs-lisp hl_lines=1-3 >}}
  (+ 1 2)
  (+ 1 2)
  (+ 1 2)
  (+ 1 2)
  {{< / highlight }}

does.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants