From: Kaushal Modi <kaushal.modi@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>,
Jay Kamat <jaygkamat@gmail.com>
Cc: emacs-org list <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] Add TITLE export to ox-md
Date: Thu, 24 Aug 2017 10:28:34 +0000 [thread overview]
Message-ID: <CAFyQvY00b0Ouuz7LuQvRK4cWYc6Sdsdt_gNc8tD-MD2uRLvxSQ@mail.gmail.com> (raw)
In-Reply-To: <87a82p1fey.fsf@nicolasgoaziou.fr>
[-- Attachment #1: Type: text/plain, Size: 3098 bytes --]
On Thu, Aug 24, 2017, 5:31 AM Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:
>
> I'm not so sure about it. Vanilla Markdown does not support title.
> Neither does "ox-md.el"
>
Correct, vanilla Markdown does not support title. The file name is the
title.
For example, the file names of the Wiki pages on GitHub are rendered as
titles (that is again not using 100% vanilla Markdown, but that's a good
example specific to this question about titles).
Is there any consensus about how title are handled in _vanilla_ syntax?
>
> > -(defun org-md-template (contents _info)
> > +(defun org-md-template (contents info)
> > "Return complete document string after Markdown conversion.
> > CONTENTS is the transcoded contents string. INFO is a plist used
> > as a communication channel."
> > - contents)
> > + (concat
> > + ;; Generate title and subtitle, if possible
> > + (let ((title (and (plist-get info :with-title)
> > + (plist-get info :title)))
> > + (subtitle (plist-get info :subtitle))
> > + (style (plist-get info :md-headline-style)))
> > + (when title
> > + (concat
> > + (org-md--headline-title style
> > + 1 (org-export-data title info))
> > + (when subtitle
> > + (org-md--headline-title style
> > + 2 (org-export-data subtitle info))))))
> > + contents))
>
> But then you would need to shift all headlines 1 or 2 levels down.
> `setext' style becomes unusable because there is no room left for other
> headlines.
I will soon submit ox-hugo for review for submission to Org. That is an
enhanced Makrdown exporter backend, that also handles the post front matter
generation for the Hugo static site generator.
In there, I have added an option for the user to set an offset for the
headings in a post. By default an Org heading with 1 star becomes level-1
heading in Markdown. For ox-hugo, I have set the default to an offset of 1.
So the 1-star Org headings will now become level-2 headings in Markdown.
Here's a little snippet that implements that:
(let ((level-mark (make-string (+ loffset level) ?#)))
(concat "\n" level-mark " " todo title " " anchor "\n\n"))
(Full code: https://github.com/kaushalmodi/ox-hugo/blob/master/ox-hugo.el)
While that doesn't translate title and subtitle to level 1 and level 2
Markdown headings, it at least helps keep the font sizes of title and
level-1 Markdown headings different.
I would suggest making the title/subtitle to Markdown headings optional at
best. Because most HTML renderers will render the file name as title.
So will end up with duplicate titles: the one rendered from file name and
another from the level-1 Markdown heading based on the above quoted
org-md-template snippet.
@Jay Would this offset option help in ox-md?
Maybe we eventually end up with 3 options (something like below):
- org-md-title-as-h1
- org-md-subtitle-as-h2
- org-md-heading-offset
WDYT?
(Side question: Would it be preferred to create a scratch branch on Org for
reviewing ox-hugo? Or would the GitHub repo mentioned above be fine?)
--
Kaushal Modi
[-- Attachment #2: Type: text/html, Size: 4362 bytes --]
next prev parent reply other threads:[~2017-08-24 10:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-24 3:32 [PATCH] Add TITLE export to ox-md Jay Kamat
2017-08-24 9:30 ` Nicolas Goaziou
2017-08-24 10:28 ` Kaushal Modi [this message]
2017-08-24 14:41 ` Jay Kamat
2017-08-26 8:11 ` Nicolas Goaziou
2017-08-28 2:43 ` Jay Kamat
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFyQvY00b0Ouuz7LuQvRK4cWYc6Sdsdt_gNc8tD-MD2uRLvxSQ@mail.gmail.com \
--to=kaushal.modi@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=jaygkamat@gmail.com \
--cc=mail@nicolasgoaziou.fr \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).