8000 Adjust `fenced_divs` syntax to resemble Markdown directive syntax by benrbray · Pull Request #7514 · jgm/pandoc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Adjust fenced_divs syntax to resemble Markdown directive syntax #7514

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

benrbray
Copy link
@benrbray benrbray commented Aug 20, 2021

Resolves #7480. Adds support for blocks of the form

:::: container {.theorem #id key=value} ::::::
This is a theorem.
::::
<div id="id" class="container theorem" data-key="value">
<p>This is a theorem.</p>
</div>

Previously, you could specify only the attributes list XOR the name, but now you can do one, the other, or both. As discussed in the issue, this change was made to more closely resemble Markdown's de-facto standard for directive syntax. While this change does not fully support directive syntax, it makes documents which use directive syntax more compatible with pandoc.

Note that Markdown directives also allow [inline content] like below, but this is currently unsupported:

(unsupported)
::: name [inline-content] {key=val}
contents, which are sometimes further block elements
:::

For now, I see two options:

  • Option 1: Don't support [inline content]. I think this omission would be fine, since pandoc always creates divs from fenced sections, so it's not clear where the text should go anyway.
  • Option 2: Parse [inline content] but throw it away. This would ensure that pandoc is compatible with documents that use block directive syntax.

If we go with Option 1, this PR is ready to merge. If we go with Option 2, I would just need to make a small change.

Full support for directive syntax will, I think, require an AST change, which would be a much larger project. I think this PR is a good compromise until then!

@benrbray
Copy link
Author

Note that the original implementation I posted in the issue thread was buggy and didn't handle cases like ::: {.cls #id} correctly. So, the code here is slightly different.

@benrbray
Copy link
8000 Author
benrbray commented Sep 4, 2021

@jgm is there anything holding back this PR? No rush, just wondering if this feature needs any changes or further discussion. Thanks!

@benrbray
Copy link
Author
benrbray commented Nov 3, 2021

@jgm Gentle reminder about this PR. Thanks!

@jgm
Copy link
Owner
jgm commented Nov 3, 2021

Still considering it.

@Sporarum
Copy link

Hey, as a new pandoc user, I was really surprised it didn't work, as it does work for code blocks

I this still being considered ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make fenced_divs more consistent with Markdown Directive Syntax
3 participants
0