Controlling the previews of Markdown
This commit is contained in:
parent
10d4830f1a
commit
eee31951d2
3 changed files with 39 additions and 1 deletions
9
ha-org-pikchr-01.svg
Normal file
9
ha-org-pikchr-01.svg
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 260.64 76.32">
|
||||||
|
<path d="M2.16,38.16L74.16,38.16" style="fill:none;stroke-width:2.16;stroke:rgb(255,255,255);" />
|
||||||
|
<path d="M74.16,74.16L182.16,74.16L182.16,2.16L74.16,2.16Z" style="fill:none;stroke-width:2.16;stroke:rgb(255,255,255);" />
|
||||||
|
<text x="128.16" y="28.08" text-anchor="middle" fill="rgb(255,255,255)" dominant-baseline="central">Hello,</text>
|
||||||
|
<text x="128.16" y="48.24" text-anchor="middle" fill="rgb(255,255,255)" dominant-baseline="central">World!</text>
|
||||||
|
<polygon points="254.16,38.16 242.64,42.48 242.64,33.84" style="fill:rgb(255,255,255)"/>
|
||||||
|
<path d="M182.16,38.16L248.4,38.16" style="fill:none;stroke-width:2.16;stroke:rgb(255,255,255);" />
|
||||||
|
</svg>
|
||||||
|
|
After Width: | Height: | Size: 733 B |
9
ha-org-pikchr-02.svg
Normal file
9
ha-org-pikchr-02.svg
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 95.7888 64.8">
|
||||||
|
<path d="M2.16,62.64L54.576,62.64L54.576,32.4L2.16,32.4Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
|
||||||
|
<text x="28.368" y="47.52" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">head</text>
|
||||||
|
<path d="M54.576,62.64L93.6288,62.64L93.6288,32.4L54.576,32.4Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
|
||||||
|
<text x="74.1024" y="47.52" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">tail</text>
|
||||||
|
<path d="M2.16,32.4L93.6288,32.4L93.6288,2.16L2.16,2.16Z" style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
|
||||||
|
<text x="47.8944" y="17.28" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">something</text>
|
||||||
|
</svg>
|
||||||
|
|
After Width: | Height: | Size: 773 B |
|
@ -1095,7 +1095,8 @@ Also, I like Markdown is look like a word processor, similarly to my org files:
|
||||||
(use-package markdown-mode
|
(use-package markdown-mode
|
||||||
:straight (:host github :repo "jrblevin/markdown-mode")
|
:straight (:host github :repo "jrblevin/markdown-mode")
|
||||||
:mode ((rx ".md" string-end) . gfm-mode)
|
:mode ((rx ".md" string-end) . gfm-mode)
|
||||||
:init (setq markdown-command "multimarkdown"
|
:init (setq markdown-command (expand-file-name "markdown" "~/bin")
|
||||||
|
markdown-open-command (expand-file-name "markdown-open" "~/bin")
|
||||||
markdown-header-scaling t)
|
markdown-header-scaling t)
|
||||||
:general
|
:general
|
||||||
(:states 'normal :no-autoload t :keymaps 'markdown-mode-map
|
(:states 'normal :no-autoload t :keymaps 'markdown-mode-map
|
||||||
|
@ -1125,6 +1126,25 @@ With the =markdown-header-scaling= set, we no longer need to color the headers i
|
||||||
:foreground default-color))))
|
:foreground default-color))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
Both the =markdown-command= and the =markdown-open-command= variables are called to render (and preview) a Markdown file (~C-c C-c o~), and calls the following scripts (which in turn, call =pandoc= as I depend on this for other org-related features):
|
||||||
|
|
||||||
|
#+begin_src sh :tangle ~/bin/markdown :shebang "#!/usr/bin/env bash" :tangle-mode u+x
|
||||||
|
pandoc --to=html --from=gfm $*
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
#+begin_src sh :tangle ~/bin/markdown-open :shebang "#!/usr/bin/env bash" :tangle-mode u+x
|
||||||
|
OUTPUT_FILE=$(mktemp 'emacs-view-XXXXXXX.html')
|
||||||
|
pandoc --to=html --from=gfm --output=$OUTPUT_FILE $*
|
||||||
|
|
||||||
|
# Are we on a MacOS Laptop:
|
||||||
|
if [ -d "/Library" ]
|
||||||
|
then
|
||||||
|
open $OUTPUT_FILE
|
||||||
|
else
|
||||||
|
firefox -new-tab $OUTPUT_FILE
|
||||||
|
fi
|
||||||
|
#+end_src
|
||||||
|
|
||||||
Using [[https://polymode.github.io/][polymode]], let’s add syntax coloring to Markdown code blocks similar to what we do with Org:
|
Using [[https://polymode.github.io/][polymode]], let’s add syntax coloring to Markdown code blocks similar to what we do with Org:
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
|
Loading…
Reference in a new issue