-
Notifications
You must be signed in to change notification settings - Fork 142
Code blocks: Implement inline markdown support for heading #1137
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
Code blocks: Implement inline markdown support for heading #1137
Conversation
e77b245 to
dead379
Compare
openorclose
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about some tests, one for a normal heading and one markdown heading?
ang-zeyu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍, just two nits:
docs/userGuide/syntax/code.mbdf
Outdated
| </span> | ||
| </include> | ||
|
|
||
| Headings support inline MarkDown some exceptions (i.e. inline code, dim text style, block quotes, headers, lists, paragraphs, footnotes and embeds). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with some exceptions
Could only mention the inline exclusions ( inline code / dim )
| + `<div class="code-block-heading"><span>${heading}</span></div>` | ||
| const renderedHeading = markdownIt.renderInline(heading); | ||
| const headingStyle = (renderedHeading === heading) ? 'code-block-heading' : 'code-block-heading inline-markdown-heading'; | ||
| return '<div class="code-block">' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent here should be 2 to the left, is github displaying it wrongly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No you're right. The pains of not having eslint consider this file. 😞
cde4580 to
e880241
Compare
a3e6484 to
387951f
Compare
marvinchin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering - what if the user wants to use symbols that are part of markdown syntax in the heading? (i.e. user wants *Title* rather than Title)
I believe markdown-it should allow escaping with \. Could we confirm that, and perhaps add that to the documentation?
In fact, that scenario is not limited to headings, but applies to anywhere markdown syntax is used, right? |
Yup, I think that should be the case. I did some digging around and it seems like we already have a page on escaping markdown - my bad for not noticing it before: I think my main concern here would be whether or not introducing this change would lead to "breaking" existing users' code block headings which use characters from the markdown syntax. I don't imagine that there are many existing usages that would fall under this category though, since this is a fairly new feature. Do you think it's necessary for us to mark this as a breaking change? |
marvinchin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found the documentation that I was requesting 👀 LGTM!
|
Noting conflicts. I'll resolve it asap. |
Remove console log and rename var Update docs increase line-heigh for headings with inline md remove line remove br update tests change css structure update tests update tests and css class name Add tests Address comments Update docs/userGuide/syntax/code.mbdf Co-Authored-By: Daryl Tan <[email protected]>
387951f to
a6337a7
Compare
|
Rebased on master, ready for merge |
…bind into remove-fixed-bugs * 'remove-fixed-bugs' of https://github.com/Tejas2805/markbind: Docs: Add contributing.md (MarkBind#1139) Show pointer and use underline dashed for click trigger (MarkBind#1111) Support variables to be defined as by JSON (MarkBind#1117) Allow an array for specifying page src or glob (MarkBind#1118) Code blocks: Implement inline markdown support for heading (MarkBind#1137) Fix lazy reload for urls without index (MarkBind#1110) Changes remaining references from filterTags to tags (MarkBind#1149)
What is the purpose of this pull request? (put "X" next to an item, remove the rest)
• [ ] Documentation update
• [ ] Bug fix
• [ ] New feature
• [X] Enhancement to an existing feature
• [ ] Other, please explain:
Fixes #1119
What is the rationale for this request?
It would be nice to support inline markdown formatting as we support it in other places.
What changes did you make? (Give an overview)
Render
headingmarkdown-it-attr as inline markdown usingmarkdownIt.renderInline(heading)If heading contains rendered inline markdown, increase line height because default line-height will make the headings crowded. As seen below
with

line-height: 1.5with

lint-height: 1Added tests as well.
Provide some example code that this change will affect:
Is there anything you'd like reviewers to focus on?
Testing instructions:
Try the test code on your own or check out
https://nbriannl.github.io/markbind-plain-site/
Proposed commit message: (wrap lines at 72 characters)
Code blocks: Implement inline markdown support for heading