org-babel.html 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="generator" content="pandoc" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
  7. <title>ORG Babel for the win!</title>
  8. <style>
  9. code{white-space: pre-wrap;}
  10. span.smallcaps{font-variant: small-caps;}
  11. span.underline{text-decoration: underline;}
  12. div.column{display: inline-block; vertical-align: top; width: 50%;}
  13. div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
  14. ul.task-list{list-style: none;}
  15. .display.math{display: block; text-align: center; margin: 0.5rem auto;}
  16. </style>
  17. <link rel="stylesheet" href="C:\SGZ_Pro\Hobbys\Writing\Org\pages\blog\styles.css" />
  18. <!--[if lt IE 9]>
  19. <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
  20. <![endif]-->
  21. <link rel="stylesheet" type="text/css" href="styles.css" />
  22. </head>
  23. <body>
  24. <header id="title-block-header">
  25. <h1 class="title">ORG Babel for the win!</h1>
  26. </header>
  27. <h1 id="why">Why?</h1>
  28. <p>I was watching DT's video on <a href="https://invidio.xamh.de/watch?v=pQe1ul51RM0">org babel</a>. I at first didn't really like the concept becauase when he uploaded to gitlab there was no syntax highlighting :(</p>
  29. <p>Well, when finally trying it out for myself. Apperently babel is built in with emacs by the way. I instinctivly put the language of what I was putting in a source code block. Since I was doing this on my init.el I put lisp. Your actually supposed to put elisp for proper syntax highlighting.</p>
  30. <h1 id="result">Result</h1>
  31. <p>A absolutely beautiful file that looks awesome on git website and is cool to edit.</p>
  32. <h1 id="how">HOW?</h1>
  33. <h1 id="section">1.</h1>
  34. <p>Take the contents of the file you want to convert to org. Put it in a separate file with the .org extension. If you want to have it in a GIT repository make the file README.org so when opening a folder with the file you will get a preview of it.</p>
  35. <h1 id="section-1">2.</h1>
  36. <p>Go to the top of the file and add this:</p>
  37. <pre class="org"><code>#+PROPERTY: header-args :tangle &lt;file name&gt;
  38. </code></pre>
  39. <p>Obviously replace <strong>&lt;file name&gt;</strong> with your desired exported file name.</p>
  40. <h1 id="section-2">3.</h1>
  41. <p>Start putting source code blocks using <code class="verbatim">#+BEGIN_SRC</code> elisp and <code class="verbatim">#+END_SRC</code> all over the place. It would look like this:</p>
  42. <p><code class="verbatim">#+BEGIN_SRC elisp</code></p>
  43. <p>;; Happy fun code :D</p>
  44. <p><code class="verbatim">#+END_SRC</code></p>
  45. <h1 id="section-3">4.</h1>
  46. <p>For the first time you have to do a <code class="verbatim">C-c C-c</code> to refresh the document. After that you can just continue pressing: <code class="verbatim">M x org babel tangle</code> or <code class="verbatim">C-c C-v t</code> when you making changes to your file in org to export it to the actual file.</p>
  47. <h1 id="my-init.el-written-in-org">My init.el written in org!</h1>
  48. <p>I did this on my <a href="https://codeberg.org/zortazert/Dots/src/branch/main/emacs.d">init.el</a> file.</p>
  49. <h1 id="note">NOTE:</h1>
  50. <p>This probably isn't limited to just coding files. Probably there are other use cases</p>
  51. </body>
  52. </html>