question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FR: Format the code gracefully

See original GitHub issue

Is Your Feature Request Related to a Problem? Please Describe.

Whenever I copy my code from vscode to obsidian, the following puzzling phenomena will occur vscode: image Copying to obsidian becomes code with many newlines image

A clear and concise description of what the problem is. Ex. I’m always frustrated when […] To tell the truth, these new lines will make me feel very uncomfortable

Describe the Solution You’d Like

I hope so, and it will be better to carry the function of automatically formatting code, just like Prettier image

A clear and concise description of what you want to happen.

Please include an example where applicable:

```jsx
export default class App extends Component {

  constructor() {

    this.state = {

      age: 18,

    };

  }

  render() {

    return <ChildComp props={{ age: this.age }}></ChildComp>;

  }

}

``` markdown
```jsx
export default class App extends Component {
  constructor() {
    this.state = {
      age: 18,
    };
  }
  render() {
    return <ChildComp props={{ age: this.age }}></ChildComp>;
  }
}

## Describe Alternatives You've Considered

A clear and concise description of any alternative solutions or features you've considered.

## Additional Context

Add any other context or screenshots about the feature request here.

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
Gewerd-Strausscommented, Dec 2, 2022

This is a normal obsidian feature. You can toggle it off in the settings under Editor → Display → Show indentation guides: Toggled On: grafik

Toggled Off: grafik


Addendum:

Then I found that this happens when I use the Tab in the code block.

This is not completely correct. The indentation guides are triggered when the depth for a tab is reached. This means that either pressing a tab, or X spaces will be rendered the same. The setting Editor → Behaviour → Tab Indent Size will decide how many spaces a tab gets rendered as.

0reactions
pjkaufmancommented, Dec 8, 2022

Hey @Chen-913 , I wanted to see if the suggested setting change satisfies your request. The Linter cannot get rid of those visual indentation indicators as they are a display setting created Obsidian. If it does not fix your issue, if you could clarify exactly what kind of codeblock formatting you are looking for, this may become a small enough scope to make it actionable. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

gracefully handle the fact that Black does not support "Format ...
The latest VS Code allows the users to configure the formatting for the entire file or line of code changed, so many sure...
Read more >
How to get Python to gracefully format None and non-existing ...
The recommendation in PEP 3101 is to subclass Formatter: import string class PartialFormatter(string.Formatter): def __init__(self, ...
Read more >
mercurial / format-source · GitLab - Projects - Heptapod
A Mercurial extension to apply and gracefully merge code formatting.
Read more >
Piping buffer through a command, handling failure gracefully
I want to be able to lint my code ...
Read more >
Reformat and rearrange code | PyCharm Documentation
You can select formatting rules which will be ignored when you reformat the code. For example, you can adjust the IDE to keep...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found