Giter Site home page Giter Site logo

cm-show-whitespace-obsidian's People

Contributors

actions-user avatar arnoesterhuizen avatar deathau avatar gordonped avatar jjspace avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cm-show-whitespace-obsidian's Issues

Doesn't work with Live Preview

Not sure how this would best be implemented but it would be really cool if this could work with the live preview editor as well! Maybe showing only non-previewed whitespaces? Currently none are shown at all.

Doesn't work on mobile

I tried the plugin on Android, and it doesn't seem to do anything.
Additionally I found this while loading inspecting with the Chrome adb debugger:

Uncaught TypeError: cm.setOption is not a function
    at eval (eval at <anonymous> (app.js:1), <anonymous>:139:64)
    at app.js:1
    at t.iterateLeaves (app.js:1)
    at t.iterateLeaves (app.js:1)
    at t.iterateAllLeaves (app.js:1)
    at t.iterateCodeMirrors (app.js:1)
    at CMShowWhitespacePlugin.t.registerCodeMirror (app.js:1)
    at CMShowWhitespacePlugin._this.enable (eval at <anonymous> (app.js:1), <anonymous>:139:19)
    at t.e.tryTrigger (app.js:1)
    at t.e.trigger (app.js:1)

Use the official API method for disabling settings

Back when I added settings for specific whitespace characters there was not an official way to disable settings so I used this css hack and created a request on their API github obsidianmd/obsidian-api#8

  .plugin-cm-show-whitespace-disabled {
    opacity: 0.6;

    .checkbox-container {
      cursor: not-allowed;
      // this is *not* an adequate way to disable an input but it's all we can do right now
      pointer-events: none;
    }
  }

There is now an official way in the API to disable a setting using setDisabled on both Setting and Component level. This section should be updated to use the new method.

Shows NBSP characters as ordinary spaces

I've just installed this plugin and switched to Legacy editor, having been bitten by some hidden NBSP characters copied for a GitHub issue which caused me confusion in a Tasks plugin issue

This is what I hoped that this plugin would display - as screenshotted in PyCharm:

image

This is what it actually displayed...

image

That is, the NBSP is indistinguishable from an ordinary space.

New line character disappears

The last new line character of files disappears after placing the cursor on that line.

Empty last line

Not empty last line

A CSS Snippet to work with newer versions of Obsidian

Hi folks, I have gathered the following snippet to make this plugin work with Obsidian v1.3.7 (more or less, I forgot how it used to work and wrote it for my own needs). Please feel free to use and make changes. Cheers.

Edit: The br fixes do not work on iOS.

Edit 2: Added new line indicators for non-empty lines.

Please consult the doc if you are new to the snippets.

Details
body.plugin-cm-show-whitespace [class*=cm-trailing-space]::after,
body.plugin-cm-show-whitespace [class*=cm-trailing-space]::before {
  color: var(--text-muted);
}

.cm-line br {
  content: "&nbsp;";
  display: inline-block;
}

.cm-line br::after,
.cm-line:not(:has(br)):not(:has(.cm-trailing-space-new-line))::after {
  content: var(--newlineChar);
  white-space: pre;
  pointer-events: none;
  color: var(--text-muted);
  font-weight: normal;
  opacity: 0.5;
  padding-inline-start: 2px;
}

Bug -- Weird behavior with check box CSS

Hey!

So i normally use this for my check box CSS:

/* ...... 2.7.1 Nicer Round Checkboxes -- https://forum.obsidian.md/t/meta-post-common-css-hacks/1978/34 */
input[type="checkbox"],
.cm-formatting-task {
  -webkit-appearance: none;
  appearance: none;
  border-radius: 50%;
  border: 1px solid var(--text-faint);
  padding: 0;
  vertical-align: top;
}
.cm-s-obsidian span.cm-formatting-task {
  color: transparent;
  width: 1.25em !important;
  height: 1.25em;
  display: inline-block;
}
input[type="checkbox"]:focus {
  outline: 0;
}
input[type="checkbox"]:checked,
.cm-formatting-task.cm-property {
  background-color: var(--text-accent-hover);
  border: 1px solid var(--text-accent-hover);
  background-position: center;
  background-size: 70%;
  background-repeat: no-repeat;
  background-image: url('data:image/svg+xml; utf8, <svg width="12px" height="10px" viewBox="0 0 12 8" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g transform="translate(-4.000000, -6.000000)" fill="%23ffffff"><path d="M8.1043257,14.0367999 L4.52468714,10.5420499 C4.32525014,10.3497722 4.32525014,10.0368095 4.52468714,9.8424863 L5.24777413,9.1439454 C5.44721114,8.95166768 5.77142411,8.95166768 5.97086112,9.1439454 L8.46638057,11.5903727 L14.0291389,6.1442083 C14.2285759,5.95193057 14.5527889,5.95193057 14.7522259,6.1442083 L15.4753129,6.84377194 C15.6747499,7.03604967 15.6747499,7.35003511 15.4753129,7.54129009 L8.82741268,14.0367999 C8.62797568,14.2290777 8.3037627,14.2290777 8.1043257,14.0367999"></path></g></g></svg>');
}

and normal appearance in edit/preview is thus:

image
image

When i have the whitespace plugin installed (not even active) this is what displays in edit mode only, preview mode is normal:

image

image


uninstalled the plugin and reinstalled, same issue. using latest versions of plugin and obsidian and no errors appear in the developer console

Show only trailing whitespace

Would it be possible to add an option to only show whitespace at the end of a line? Similar to what you might use in a code editor.
Thank you

Incorrect positioning of cursor on empty line

When you have a blank line, the cursor is positioned AFTER the newline character. It should be before
image

When editing a line with existing text, the cursor is positioned correctly:
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.