Skip to content

Commit

Permalink
implement code line nums
Browse files Browse the repository at this point in the history
  • Loading branch information
Aayush Bajaj authored and Aayush Bajaj committed Jan 1, 2025
1 parent 25c8a3f commit 64e866c
Show file tree
Hide file tree
Showing 7 changed files with 206 additions and 9 deletions.
2 changes: 2 additions & 0 deletions assets/js/prism.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ import Prism from "prismjs";
import "prismjs/plugins/{{ . }}/prism-{{ . }}";
{{ end }}

const alias = "jupyter-python";
Prism.languages[alias] = Prism.languages.python;
Prism.highlightAll();
13 changes: 9 additions & 4 deletions config/_default/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,29 @@ enableGitInfo = true
"markup",
"css",
"clike",
"c",
"javascript",
"latex",
"python",
"bash",
"csharp",
"hcl",
"ignore",
"json",
"markdown",
"powershell",
"toml",
"yaml"
"yaml",
"docker",
"git"
]
plugins = [
"normalize-whitespace",
"toolbar",
"copy-to-clipboard",
"command-line"
"command-line",
"line-highlight",
"line-numbers",
"show-language",
"treeview"
]

# Social share links for posts:
Expand Down
6 changes: 3 additions & 3 deletions config/_default/module.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
[[mounts]]
source = "static"
target = "static"
#[[mounts]]
# source = "node_modules/prismjs"
# target = "assets/prismjs"
[[mounts]]
source = "node_modules/prismjs"
target = "assets/prismjs"
[[mounts]]
source = "node_modules/prism-themes/themes"
target = "assets/prism-themes"
Expand Down
4 changes: 2 additions & 2 deletions content/projects/_index.org
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ These projects are all those that have had a lifecycle.
:CUSTOM_ID: deep-learning
:END:
- [[/projects/dl/benchmarking][Hardware Benchmarking]]
- Perceptron #classification
- Multilayer Perceptron
- [[/projects/dl/perceptron][Perceptron]] #classification
- [[/projects/dl/mlp][Multilayer Perceptron]]
- [[/projects/dl/KiTS19][KiTS19 Kidney and Kidney Tumour Segmentation]]
- [[/projects/dl/llm-tune][Fine Tuning LLM]]
- [[/projects/dl/rag][RAG]]
Expand Down
109 changes: 109 additions & 0 deletions content/projects/dl/perceptron/_index.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
+++
title = "Perceptron"
+++

This is tomorrow's work, but for now I just want to test some codeblocks:


#+begin_src sh
pwd
#+end_src

#+begin_src command-line
pwd
#+end_src

#+begin_src treeview
.
├── LICENSE
├── README.md
├── archetypes
├── assets
├── backup
├── config
├── content
├── data
├── eslint.config.mjs
├── go.mod
├── go.sum
├── hugo-mod-json-resume
├── hugo-theme-gruvbox-inkscape.svg
├── hugo-theme-gruvbox.svg
├── hugo_stats.json
├── i18n
├── layouts
├── node_modules
├── package-lock.json
├── package.hugo.json
├── package.json
├── postcss.config.js
├── public
├── resources
├── static
└── theme.toml

14 directories, 13 files

#+end_src

#+RESULTS:
| ./ | | | |
| ├── | _index.org | | |
| └── | _index.org~ | | |
| | | | |
| 1 | directory, | 2 | files |


#+ATTR_HTML: :class line-numbers
#+begin_src c
#include <stdio.h>

int main() {
char a[5] = "hello";
printf("%s world!\n", a);
return 0;
}

#+end_src

#+begin_export html
<pre class="command-line language-bash" data-user="root" data-host="localhost">
<code>
cd /usr/local/etc
cp php.ini php.ini.bak
vi php.ini
</code>
</pre>

<pre
class="command-line language-bash"
data-user="chris"
data-host="remotehost"
data-output="2, 4-8"
>
<code>
pwd
/usr/home/chris/bin
ls -la
total 2
drwxr-xr-x 2 chris chris 11 Jan 10 16:48 .
drwxr--r-x 45 chris chris 92 Feb 14 11:10 ..
-rwxr-xr-x 1 chris chris 444 Aug 25 2013 backup
-rwxr-xr-x 1 chris chris 642 Jan 17 14:42 deploy
</code>
</pre>
#+end_export


#+begin_export html
<pre class="line-numbers language-none" data-start="42">
<code>
Hello,
World!

Foo
Bar
</code>
</pre>

#+end_export
80 changes: 80 additions & 0 deletions content/projects/dl/perceptron/_index.org~
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
+++
title = "Perceptron"
+++

This is tomorrow's work, but for now I just want to test some codeblocks:


#+begin_src sh
pwd
#+end_src

#+begin_src command-line
pwd
#+end_src

#+begin_src bash
tree -F
#+end_src

#+RESULTS:
| ./ | | | |
| ├── | _index.org | | |
| └── | _index.org~ | | |
| | | | |
| 1 | directory, | 2 | files |


#+ATTR_HTML: :class line-numbers
#+begin_src c
#include <stdio.h>

int main() {
char a[5] = "hello";
printf("%s world!\n", a);
return 0;
}

#+end_src

#+begin_export html
<pre class="command-line language-bash" data-user="root" data-host="localhost">
<code>
cd /usr/local/etc
cp php.ini php.ini.bak
vi php.ini
</code>
</pre>

<pre
class="command-line language-bash"
data-user="chris"
data-host="remotehost"
data-output="2, 4-8"
>
<code>
pwd
/usr/home/chris/bin
ls -la
total 2
drwxr-xr-x 2 chris chris 11 Jan 10 16:48 .
drwxr--r-x 45 chris chris 92 Feb 14 11:10 ..
-rwxr-xr-x 1 chris chris 444 Aug 25 2013 backup
-rwxr-xr-x 1 chris chris 642 Jan 17 14:42 deploy
</code>
</pre>
#+end_export


#+begin_export html
<pre class="line-numbers language-none" data-start="42">
<code>
Hello,
World!

Foo
Bar
</code>
</pre>

#+end_export
1 change: 1 addition & 0 deletions layouts/shortcodes/.#collapse.html

0 comments on commit 64e866c

Please sign in to comment.