Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support GFM alerts (admonitions) #9475

Closed
jdtsmith opened this issue Feb 19, 2024 · 3 comments
Closed

Support GFM alerts (admonitions) #9475

jdtsmith opened this issue Feb 19, 2024 · 3 comments

Comments

@jdtsmith
Copy link

jdtsmith commented Feb 19, 2024

Describe your proposed improvement and the problem it solves.

Support the new GFM Alerts (also called admonitions), which look like this:

> [!NOTE]
> This is a note

> [!CAUTION]
> This note cautions you

These could map back to org syntax #+begin_note...#+end_note and similar.

Describe alternatives you've considered.

ox-gfm, but it does not support them and seems unmaintained.

@jdtsmith jdtsmith changed the title Support GFM alerts Support GFM alerts (admonitions) Feb 19, 2024
@jgm
Copy link
Owner

jgm commented Feb 19, 2024

They are supported!

% pandoc -t native -f gfm
> [!NOTE]
> This is a note

> [!CAUTION]
> This note cautions you
[ Div
    ( "" , [ "note" ] , [] )
    [ Div ( "" , [ "title" ] , [] ) [ Para [ Str "Note" ] ]
    , Para
        [ Str "This"
        , Space
        , Str "is"
        , Space
        , Str "a"
        , Space
        , Str "note"
        ]
    ]
, Div
    ( "" , [ "caution" ] , [] )
    [ Div ( "" , [ "title" ] , [] ) [ Para [ Str "Caution" ] ]
    , Para
        [ Str "This"
        , Space
        , Str "note"
        , Space
        , Str "cautions"
        , Space
        , Str "you"
        ]
    ]
]

Currently the org writer doesn't react to this structure, but you can write a Lua filter that adds whatever special treatment you think is appropriate.

If there are standardized and obvious ways to represent these in org, we could consider implementing them in the writer. Otherwise I'd prefer to leave it up to the user to configure this through filters.

@jdtsmith
Copy link
Author

jdtsmith commented Feb 19, 2024

Very cool, thanks! There is this syntax using special blocks, supported by some org-export renderers. I am interested in org read support to produce this type of structure, and write to GFM.

@jgm
Copy link
Owner

jgm commented Feb 19, 2024

I think it should make sense to support this in both the reader and the writer.

@jgm jgm closed this as completed in 54b001a Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants