Handling Complex Headings
See original GitHub issueIt appears that headings with any sort of complexity (i.e. part bold, part normal) are being split and not fully processed. An example would be a simple document such as this:
(Available at https://docs.google.com/document/d/1cZ7o50cWtnljBFhLabvvAHRTnSeu13Yr1jHFx0ol5CQ/edit?usp=sharing)
Expected Behavior
I would expect this to render as:
## **Part Bold** Part Not\n\n\nSome other text\n
or in HTML as:
<h2><strong>Part Bold<strong> Part Not</h2>\n<p>Some other text</p>
Actual Behavior
The “Part Bold” item is omitted from the output. Renders as:
## Part Not\n\n\nSome other text\n
and
<h2>Part Not</h2>\n<p>Some other text</p>
Info
Here is an example query in Gatsby:
{
googleDocs(slug: {eq: "/debug"}) {
childMarkdownRemark {
rawMarkdownBody
html
}
document {
body {
content {
paragraph {
paragraphStyle {
namedStyleType
}
elements {
textRun {
content
}
}
}
}
}
}
}
}
and the resulting output, which shows that the “Part Bold” item is in the Google Docs API response:
{
"data": {
"googleDocs": {
"childMarkdownRemark": {
"rawMarkdownBody": "## Part Not\n\n\nSome other text\n",
"html": "<h2>Part Not</h2>\n<p>Some other text</p>"
},
"document": {
"body": {
"content": [
{
"paragraph": null
},
{
"paragraph": {
"paragraphStyle": {
"namedStyleType": "HEADING_1"
},
"elements": [
{
"textRun": {
"content": "Part Bold"
}
},
{
"textRun": {
"content": " Part Not\n"
}
}
]
}
},
{
"paragraph": {
"paragraphStyle": {
"namedStyleType": "NORMAL_TEXT"
},
"elements": [
{
"textRun": {
"content": "Some other text\n"
}
}
]
}
}
]
}
}
}
},
"extensions": {}
}
If you think the expected behavior is correct and can give some pointers as to where to start looking, I’d be happy to submit a pull request with a fix
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Tables with Multi-Level Headers - W3C
This page covers tables that have multi-level header cells associated per data cell. Such tables are too complex to identify a strict horizontal...
Read more >Complex headers (rowspan and colspan) - DataTables example
Name Position Salary Office Extn. E‑mail
Airi Satou Accountant $162,700 Tokyo 5407 a.satou...
Angelica Ramos Chief Executive Officer (CEO) $1,200,000 London 5797 a.ramos...
Ashton Cox Junior...
Read more >Managing Heading Levels In Design Systems | by Heydon
While individual patterns/components within a design system can — and should — use headings, it's difficult to know which heading levels ...
Read more >Complex Table Header IDs - YouTube
Kenny Moore of TaggedPDF.com presents a suggestion for remediating a complex table for accessibility using Header IDs.
Read more >How to handle complex header recursion with variants and ...
One possible solution is to split headers into forward declarations and implementations: // AB_forward.hpp #pragma once #include <ostream> ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you for reporting this! There was a bug with all options. It’s now resolved with
2.0.1
version.It strange that
demoteHeadings
option change the behaviour because it should just change the title level.For the “bold” case, there is a specific case. Unfortunately, Google Docs default headings are bold. So bold is disabled for headings here to avoid DOM to be
<h2><b>Heading</b></h2>
all the time. I think heading should be style using cssh2 { font-weight: bold }
for example.But for your use case, “Part Bold” text should be there!