How to make bold just a part of a word? #653

Closed
opened 2026-01-29 14:42:10 +00:00 by claunia · 1 comment
Owner

Originally created by @ghost on GitHub (Jan 31, 2024).

I have a string that needs to be transformed into HTML format.

非常抱歉,{{coachname}}无法再在**{{sessiondate}}**的**{{sessiontime}} {{sessiontimezone}}**进行您即将参加的教练谈话。

The result of Markdig Markdig.Markdown.ToHtml is

非常抱歉,{{coachname}}无法再在**{{sessiondate}}<strong>的</strong>{{sessiontime}} {{sessiontimezone}}**进行您即将参加的教练谈话。

Some of the (** ) were converted to HTML, while others were not.
I guess the problem is with spaces. Ideally, Markdig expects something like hello but not hello.

What is the appropriate way to handle such a string that I have above?
More examples:
image
image

where:
value - is the original string that should be converted.
markdig - the result of Markdig package work
markdown - the result of the legacy Markdown package

Originally created by @ghost on GitHub (Jan 31, 2024). I have a string that needs to be transformed into HTML format. `非常抱歉,{{coachname}}无法再在**{{sessiondate}}**的**{{sessiontime}} {{sessiontimezone}}**进行您即将参加的教练谈话。` The result of **Markdig** `Markdig.Markdown.ToHtml` is `非常抱歉,{{coachname}}无法再在**{{sessiondate}}<strong>的</strong>{{sessiontime}} {{sessiontimezone}}**进行您即将参加的教练谈话。` Some of the (** ) were converted to HTML, while others were not. I guess the problem is with spaces. Ideally, Markdig expects something like **hello** but not **he**llo. What is the appropriate way to handle such a string that I have above? More examples: <img width="907" alt="image" src="https://github.com/xoofx/markdig/assets/51709614/ca90e589-c5d2-46ef-86ba-ea39c439b153"> <img width="1369" alt="image" src="https://github.com/xoofx/markdig/assets/51709614/3d7b8528-6163-4426-aef9-c13c57c6c55a"> where: value - is the original string that should be converted. markdig - the result of Markdig package work markdown - the result of the legacy Markdown package
claunia added the question label 2026-01-29 14:42:10 +00:00
Author
Owner

@xoofx commented on GitHub (Jan 31, 2024):

Similar issue to https://github.com/xoofx/markdig/issues/765#issuecomment-1914833501

在**{{sessiondate}}**的 cannot work because { or } is a punctuation character, so you have to put a space before (for the opening) or after (for the closing so that 在 **{{sessiondate}}** 的 would render properly 在 {{sessiondate}}

See babelmark here and you can verify that all CommonMark implementations behave the same here.

It is normal that you will get lots of error when converting from markdown - the result of the legacy Markdown package to CommonMark, but it will be unlikely an issue with Markdig, but more something that you will have to change in these templates to comply with CommonMark.

@xoofx commented on GitHub (Jan 31, 2024): Similar issue to https://github.com/xoofx/markdig/issues/765#issuecomment-1914833501 `在**{{sessiondate}}**的` cannot work because `{` or `}` is a punctuation character, so you have to put a space before (for the opening) or after (for the closing so that `在 **{{sessiondate}}** 的` would render properly 在 **{{sessiondate}}** 的 See babelmark [here](https://babelmark.github.io/?text=%E5%9C%A8**%7B%7Bsessiondate%7D%7D**%E7%9A%84%0A%0A%E5%9C%A8+**%7B%7Bsessiondate%7D%7D**+%E7%9A%84) and you can verify that all CommonMark implementations behave the same here. It is normal that you will get lots of error when converting from `markdown - the result of the legacy Markdown package` to CommonMark, but it will be unlikely an issue with Markdig, but more something that you will have to change in these templates to comply with CommonMark.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#653