all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Diego Zamboni <diego@zzamboni.org>,
	Daryl Manning <dwm+orgmode@wakatara.com>
Cc: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: Tricking org-mode into using markdown conventions
Date: Mon, 04 May 2020 12:15:05 +0800	[thread overview]
Message-ID: <874kswnxo6.fsf@localhost> (raw)
In-Reply-To: <CAGY83EfFbjEE-xaAq=fOg0pFEj2vGW6f_cXaBvFL-1MmS7R1_g@mail.gmail.com>

> I did a quick test, and it seems
> that =prettify-symbols-alist= (which is what this code uses) can only
> replace for a single character, so I was not able to make it display
> the three backticks, but there might be other techniques that can be
> used.

Yes, there is another technique.
See part of my config below:


  (defun yant/str-to-glyph (str)
    "Transform string into glyph, displayed correctly."
    (let ((composition nil))
      (dolist (char (string-to-list str)
		    (nreverse (cdr composition)))
	(push char composition)
	(push '(Br . Bl) composition))))

  (append pretty-symbol-patterns
  	`(((yant/str-to-glyph " ") org-specific ,(format  "^\\(\\*\\{%d,%d\\}\\)\\*[^*]" (1- org-inlinetask-min-level) (1- org-inlinetask-max-level)) (org-mode) 1)
          ((yant/str-to-glyph "⇒⇒⇒") org-specific ,(format  "^\\(\\*\\{%d,%d\\}\\)\\(\\*\\)[^*]" (1- org-inlinetask-min-level) (1- org-inlinetask-max-level)) (org-mode) 2)
          (?╭ org-specific "^[ ]*#[+]NAME" (org-mode))
          (?╭ org-specific "^[ ]*#[+]name" (org-mode))
          (?├ org-specific "[ ]*#[+]begin_src" (org-mode))
          (?├ org-specific "[ ]*#[+]BEGIN_SRC" (org-mode))
          (?╰ org-specific "[ ]*#[+]end_src" (org-mode))
          (?╰ org-specific "[ ]*#[+]END_SRC" (org-mode))
          ((yant/str-to-glyph "📁📁📁") org-specific ":\\(ATTACH\\):" (org-mode) 1)
       	  ((yant/str-to-glyph "☠D") org-specific "\\<DEADLINE:" (org-mode))
       	  ((yant/str-to-glyph "◴S") org-specific "\\<SCHEDULED:" (org-mode))))

Diego Zamboni <diego@zzamboni.org> writes:

> Hi Daryl,
>
> If it's for display purposes only, you might be able to simply use
> display substitutions for things to appear the way you want. For
> example, I use the technique described here:
> https://pank.eu/blog/pretty-babel-src-blocks.html to replace the
> begin/end_src strings with symbols. I did a quick test, and it seems
> that =prettify-symbols-alist= (which is what this code uses) can only
> replace for a single character, so I was not able to make it display
> the three backticks, but there might be other techniques that can be
> used.
>
> --Diego
>
> On Sun, May 3, 2020 at 6:24 PM Daryl Manning <dwm+orgmode@wakatara.com> wrote:
>>
>> While using C-c C-, is easy enough for insertion and such, I was wondering if there was any way of having org-mode honour markdown conventions for things like code fences and quotes.
>>
>> ``` elisp
>> #+begin_src
>> #+end_src
>>
>> #+begin_quote
>> #+end_quote
>> ```
>>
>> being a bit nicer to read with
>>
>> ``` go
>> code block
>> ```
>> as well as
>>
>> > And gentlemen in England now-a-bed.
>> > Shall think themselves accurs'd they were not here,
>> > And hold their manhoods cheap whiles any speaks.
>> > That fought with us upon Saint Crispin's day.
>>
>> Just curious as to whether that's possible. YMMV before you start debating on whether you think this is a good idea or not... =]
>>
>> Of course, I'd want the code highlighting especially to work that way, though... =]  Less concerned with whether it works in export modes for the moment, more about display atm.
>>
>> thanks!
>> Daryl.
>>
>>
>>
>>
>>
>

-- 
Ihor Radchenko,
PhD,
Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong University, Xi'an, China
Email: yantar92@gmail.com, ihor_radchenko@alumni.sutd.edu.sg


  reply	other threads:[~2020-05-04  4:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-03 16:22 Tricking org-mode into using markdown conventions Daryl Manning
2020-05-03 16:39 ` Diego Zamboni
2020-05-04  4:15   ` Ihor Radchenko [this message]
2020-05-04  7:37     ` Diego Zamboni
2020-05-05  8:12       ` Daryl Manning
2020-05-05  8:42         ` Diego Zamboni
2020-05-05  8:46         ` Ihor Radchenko
2020-05-05 17:22           ` Berry, Charles via General discussions about Org-mode.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874kswnxo6.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=diego@zzamboni.org \
    --cc=dwm+orgmode@wakatara.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.