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

Render reStructuredText notes in JIRA output #10561

Open
KevinGDialpad opened this issue Jan 22, 2025 · 2 comments
Open

Render reStructuredText notes in JIRA output #10561

KevinGDialpad opened this issue Jan 22, 2025 · 2 comments

Comments

@KevinGDialpad
Copy link

reStructuredText has a concept of notes and warnings.
Confluence has info, tip, note, and warning macros

When converting from RST to Confluence, notes and warnings are currently ignored (essentially):

$ cat input.rst 
This is some text

.. note::

   This is a note

And some more text
$ docker run --rm --volume "$(pwd):/data" --user $(id -u):$(id -g) pandoc/core input.rst --from rst --to jira
This is some text

Note

This is a note

And some more text
$ docker run --rm  pandoc/core -v | head -n 1
pandoc 3.6.2

I'd love to have them converted to note and warnings macros instead. In this specific example, I'd like an output like

This is some text

{note}This is a note{note}

And some more text

which looks great on Confluence:

Image

(FWIW I'd rather use {info} for notes because {note} looks more like a warning...)


2 thoughts about this. First, I haven't looked at Pandoc internals, so I'm not sure whether it already detects RST notes and warnings.

Also, it seems that Pandoc doesn't distinguish between JIRA and Confluence. Clicking on "Jira wiki markup" on https://pandoc.org/ goes to https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=all, which doesn't mention {note} at all.

It sounds like the {note} macro is a Confluence thing, and I'm guessing it wouldn't work on non-Confluence Atlassian things. So maybe we shouldn't use it in an output format named jira.

Maybe this ticket requires separating JIRA and Confluence as output formats. Which would requires finding a spec for the Confluence format. An alternative would be to use {panel} instead, which is specified in the "Text Formatting Notation Help" document, so it's more likely to be supported across Atlassian products.

@jgm
Copy link
Owner

jgm commented Jan 23, 2025

Another alternative would be to use a Lua filter to format the output this way.
Something like

function Div(el)
  if el.classes:includes("note") then
    table.remove(el.content, 1) -- remove title
    table.insert(el.content, 1, pandoc.RawBlock("jira", "{note}"))
    table.insert(el.content, pandoc.RawBlock("jira", "{note}"))
    return el
  end
end

This will give you a blank line after {note}; I'm assuming that will still work, but if not, something more complex would be needed.

@KevinGDialpad
Copy link
Author

Ah, interesting. I shall look into this as well, thank you! Pretty sure the blank line is indeed okay.

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