asciidoctor / kramdown-asciidoc

A kramdown extension for converting Markdown documents to AsciiDoc.
Other
207 stars 19 forks source link

question about attributes #79

Closed jerCarre closed 3 years ago

jerCarre commented 4 years ago

Hello,

I want to use custom attributes in generated asciidoctor file. So in md (not GFM) I define a Yaml Front Matter with my "custom-attribute" and in the body of the document I try to use it with the syntax {custom-attribute}. but during kramdown-asciidoc conversion, {custom-attribute} becomes {custom-attribute}, why ? and how can I change this ?

thx

mojavelinux commented 3 years ago

That's not how this converter works. That's because Markdown doesn't understand attribute references. The converter takes keys in the front matter and rewrites them as attribute entries in the AsciiDoc document header. You can then use those attribute references in the AsciiDoc document, but you need to add them after conversion to AsciiDoc.

In other words, given this Markdown:

---
key: value
---

# Title

content

It produces this AsciiDoc:

= Title
:key: value

content

You then then modify the AsciiDoc to use this attribute reference like so:

= Title
:key: value

The attribute named key is {key}.