-
Notifications
You must be signed in to change notification settings - Fork 0
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 for block elements in headings #111
Comments
It would be great to support that feature! Thanks for the feedback. |
After researching various options, it seems challenging to implement this feature due to the specifications of mdast and remark. For example, consider the following markdown: > [!note] title here
> body here This is transformed into the following mdast, and this plugin generates the callout by manipulating this mdast. {
"type": "root",
"children": [
{
"type": "blockquote",
"children": [
{
"type": "paragraph",
"children": [
{
"type": "text",
"value": "[!note] # title here\nbody here",
"position": {
"start": {
"line": 1,
"column": 3,
"offset": 2
},
"end": {
"line": 2,
"column": 12,
"offset": 34
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 3,
"offset": 2
},
"end": {
"line": 2,
"column": 12,
"offset": 34
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 2,
"column": 12,
"offset": 34
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 2,
"column": 12,
"offset": 34
}
}
} Notice that the title part of the callout exists as a paragraph in the mdast. According to the CommonMark specifications, only inline elements are allowed as children of a paragraph. Therefore, block elements cannot exist within a paragraph, making it impossible to use block elements as the title of a callout. Furthermore, the heading included in the title part exists as text within the mdast. To recognize this as a heading element, the plugin would need to re-parse this string with remark, which is somewhat difficult to do accurately on the plugin side. I am in favor of adding this feature, so if anyone is able to implement it, please feel free to mention me or send a PR. |
Obsidian itself also supports block elements in headings, like this:
Maybe this could be added here as well, for feature parity? :-)
The text was updated successfully, but these errors were encountered: