larstvei / ox-gfm

Github Flavored Markdown Back-End for Org Export Engine
230 stars 44 forks source link

title is not exported #21

Closed gongzhitaao closed 7 years ago

gongzhitaao commented 7 years ago

The title is not exported.

#+TITLE: test

just a test

will be exported to

just a test

The expected result should be

test
====

just a test
larstvei commented 7 years ago

Hi, thanks for reporting!

I'm going to give a similar answer to #17. This problem also occurs in the standard markdown exporter. Becuase ox-gfm is derived from that it would be preferable to fix the problem there, killing two birds with one stone.

Could you perhaps report the problem on the Org mailing list?

gongzhitaao commented 7 years ago

Sure. I will report this issue when gmane is back online LOL.

ghost commented 7 years ago

Should the title really be handled as a first-level heading? It might be an option exposed to the user.

I'd actually like to see the org metadata to be translated to YAML front-matter per https://github.com/blog/1647-viewing-yaml-metadata-in-your-documents. This wouldn't really be suitable for general markdown, as I believe YAML front-matter is a GFM feature.

jgkamat commented 7 years ago

Firstly, sorry for overloading this issue, it dosen't relate to ox-gfm too much, but since it's here I thought I would make a few comments.

I'm trying to work on fixing this in ox-md.el, but I wanted some feedback (as said earlier) on the method of implementing this.

Right now, I'm thinking of just using the html header (since all html is valid markdown) which would bring in both the title and subtitle properties into the md exporter. It looks something like this:

<h1 class="title">TITLE
<br />
<span class="subtitle">SUBTITLE</span>
</h1>

I do agree that there should be an option exposed for the type of export, so that users can use a # TITLE export if they wish that, but does the above sound like a good option for now? It seems to render fine in the github editor fwiw. I probably would submit two patches, one to establish a basic method (that I decide on) and one later to expose an option and add the other title exports)

I don't like the option of yaml front matter in the md exporter, since the md editor can't depend on gfm features (so it's compatible with all the implementations).

So In summary, the options I see as availble are:

  1. Html, per above
  2. # title and ## subtitle
Title
====

Let me know what you think!

larstvei commented 7 years ago

I lean towards a non-html solution where possible for a nicer looking source. The second option would cause #+TITLE: title and * title to export to the same which seems non-ideal. The third option looks nice, but it leaves the #+SUBTITLE subtitle unaccounted for. This can be solved by letting subtitles be exported to:

subtitle
--------

which is the h2-equivalent of

Title
====

It's worth noting that the underline variants don't render different from # title and ## subtitle, but the difference is clear in the markup.

What I do like with the html-variant you propose is that there won't be a thin line between the title and subtitle in the rendered version, but I'm not sure this outweighs the benefit of a nice looking source.

jgkamat commented 7 years ago

Definetly agree with you about the readability, I hadn't considered that. I'll make the alternate title format the default, assuming the org maintainer is :+1: on it. Thanks for the feedback! :smile:

larstvei commented 7 years ago

Glad I could help, and thanks for your contributions!

jgkamat commented 7 years ago

It actually appears that org-md has a configurable headline style (So you can choose which one to use). I would rather honor that setting, but I do agree with you about how html is less readable, so I'm going to stick with just standard headlines for now (So title won't be different from a H1 level). I'm going to ask for feedback on the org mailing list as well, they probably will have good ideas on how to solve this problem too :).

larstvei commented 7 years ago

Seeing as this issue is an ox-md.el issue, I'll close it.

benley commented 5 years ago

The outcome on the emacs-orgmode list appears to have leaned toward pushing features like this one out to ox-gfm and ox-hugo: https://lists.gnu.org/archive/html/emacs-orgmode/2017-08/msg00628.html

Would you be open to adding support to ox-gfm at some point?