-4

I want to make a code fence, and in that code fence, I want bold text.

I have tried:

  1. <strong>bold</strong>

  2. **Bold**

But they don't work.

Here is what I want to happen:

import tkinter as tk
from tkinter import messagebox

def popup(message, title=None):
    root = tk.Tk()
    root.withdraw()
    root.wm_attributes("-topmost", 1)
    messagebox.showinfo(title, message, parent=root, **`default = "ok"`**)

    root.destroy()

popup('foo')

I want the default = "ok" part to be in bold.

1
  • 1
    I go with comments next to the item that I want to draw emphasis on. I'm not entirely sure if Python allows it (probably it does), but I tend to go with something like this - look at the bottom most code block. You have flexibility of how to exactly position things in comments. It can be useful for drawing things, as well like I did here. Just ideas for how you can get by without highlighting - feel free to find other creative uses for code comments.
    – VLAZ
    Jun 18, 2020 at 11:21

1 Answer 1

0

Place the asterisks before the backticks.

This:

**`text`**

becomes this:

text

8
  • 1
    But how to make only "ex" in "text" bold? While the entire "text" is in a code fence?
    – Scratte
    Jun 18, 2020 at 1:39
  • 1
    @Scratte You can't because then the system cannot differentiate what is code and what is markdown. Jun 18, 2020 at 1:42
  • 1
    @Scratte Thank you. That is my question. Thanks for the answer, it did help me, but I have that question as well.
    – 10 Rep
    Jun 18, 2020 at 1:43
  • @TheMaker I already understand what you want. You can't specify what code you want bolded because double asterisks is valid code in some programming languages. Jun 18, 2020 at 1:48
  • @JonathanRosa But I have seen people do it before! It was years ago, so I can't find which question it was.
    – 10 Rep
    Jun 18, 2020 at 1:51
  • 2
    @TheMaker That must've been an error. This article says "Markdown and HTML are ignored within a code block" and code spans as well (stackoverflow.com/editing-help#code) Jun 18, 2020 at 1:54
  • 1
    Testing t**ex**t.. Sorry, had to try. You're right. It's not working. Just like java.**time** doesn't work.
    – Scratte
    Jun 18, 2020 at 8:58
  • 2
    @JonathanRosa Except it wasn't an error because you can meta.stackexchange.com/a/32717 Jun 18, 2020 at 8:58

Not the answer you're looking for? Browse other questions tagged .