Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

163
Views
How to set Monaco editor inline font size?

I want to have the effect like this:

enter image description here

So I use editor.deltaDecorations() to edit inline css class. this is my code

var content = [
    'xxx line 1 xxx',
    'xxx title xxx',
    'xxx line 3 xxx'
].join('\n');

var editor = monaco.editor.create(document.getElementById('container'), {
    value: content,
    language: 'plaintext'
});

var decorations = editor.deltaDecorations(
    [],
    [
        {
            range: new monaco.Range(2, 4, 2, 10),
            options: {
                inlineClassName: 'myclass'
            }
        }
    ]
);

css

.myclass {
    color: red;
    font-size: 50px;
}

The result is

enter image description here

Monaco editor changed the font size, but didn't recalculate the height of line,how to solve this problem? help !

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The Monaco editor is a code editor, which implies some conditions. Some of them are:

  1. The entire editor uses the same font.
  2. The editor does not consider CSS styles for line computation.
  3. Monospaced fonts work best.
  4. Its main purpose is to display program code, which must be easy to read. Hence different fonts or font styles are rather distracting.

Monaco Editor is not a rich text editor. Use a different control if you want that.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!