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

Corner cases for fenced div attributes #48

Closed
Witiko opened this issue Nov 11, 2022 · 4 comments
Closed

Corner cases for fenced div attributes #48

Witiko opened this issue Nov 11, 2022 · 4 comments
Labels

Comments

@Witiko
Copy link
Collaborator

Witiko commented Nov 11, 2022

In #36, we added support for Pandoc's fenced divs. However, the fenced div attributes are treated as infostrings and only matched at capture time, which has a number of repercussions:

  1. Our implementation parses attributes as fenced code infostrings. Infostrings may not contain backticks, whereas attributes may (in Pandoc):

    ::: {key=value`}
    foo bar
    :::
  2. Divs with empty infostrings are not divs. Consider the following document:

    :::
    foo
    :::

    Pandoc converts this document to the following HTML output: <p>::: foo :::</p>, where as we still consider this a div.

@Witiko Witiko added the bug label Nov 11, 2022
@Witiko
Copy link
Collaborator Author

Witiko commented Nov 11, 2022

@Omikhleia ping

@Witiko Witiko changed the title Fenced div handling misparsed attributes Corner cases for fenced div attributes Nov 11, 2022
@Omikhleia
Copy link
Contributor

Omikhleia commented Nov 11, 2022

As for (1), the backtick issue is noted in #46. I would consider it very minor -- I don't quite see the real-world use case for backtick in attribute values (frankly, how many people would need this? I'd bet most logical usages are in the line of { width=200 custom-style="Framed" }...

As for (2), it could be interested to check why Pandoc explicitly forbid empty divs, at the time they designed that beast. I found discussions on the mailing lists, but it's a very long read and I failed so far to find a clean formal syntax definition (I suspect one could say the code is the syntax, lol, but my skills in reading Haskell are close to none)

@Witiko
Copy link
Collaborator Author

Witiko commented Nov 11, 2022

As for (1), the backtick issue is noted in #46. I would consider it very minor -- I don't quite see the real-world use case for backtick in attribute values (frankly, how many people would need this? I'd bet most logical usages are in the line of { width=200 custom-style="Framed" } ...

True, but you never know. We will need to make a backtick-happy infostring pattern for #49. Might as well use it here.

As for (2), it could be interested to check why Pandoc explicitly forbid empty divs, at the time they designed that beast.

Without attributes, it would be impossible to differentiate between an opening and closing fences in the following markdown text:

:::
Fenced Divs can be nested

:::
This is a nested Div
:::
:::

With attributes, we can easily differentiate between opening and closing fences, completely context-free.

@Witiko
Copy link
Collaborator Author

Witiko commented Nov 24, 2022

Closed via #51.

@Witiko Witiko closed this as completed Nov 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants