platers / obsidian-linter

An Obsidian plugin that formats and styles your notes with a focus on configurability and extensibility.
https://platers.github.io/obsidian-linter/
MIT License
1.23k stars 81 forks source link

Question: "empty-line-around-math-blocks" adds spaces in callout without the ">" symbol #1013

Closed LynetteCullens closed 6 months ago

LynetteCullens commented 9 months ago

Is the "empty-line-around-math-blocks" setting supposed to break math blocks in callouts? I don't know if my setup is normal or if people usually put math in callouts. I'm only 1 month into Obsidian.

Before Lint Render: image

Source Code:

> [!axiom] All Energy Transfer Across the Control Surface due to Fluid Flow  
> $\scriptsize{{\color{red}e}+\frac{{\color{purple}P}}{\rho}=gy+\frac{v^2}{2}+u+\frac{{\color{purple}P}}{\rho}}$
> $$\begin{align}\scriptsize{\int\int_{C.S.}^{} {{\left( {\color{red}e}+\frac{{\color{purple}P}}{\rho}\right)}\rho{({\color{grey}\overrightarrow{ v }}*{\color{pink}\overrightarrow{ n }})}}\,{d{\color{blue}A}}}= \\
\scriptsize\left[ \rho v_{x}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho} \right){\Large{\mid}}_{\scriptsize{x+\Delta x}}-\rho v_{x}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho}{\Large\mid}_{x} \right) \right]\Delta y\Delta z+ \\  
\scriptsize\left[ \rho v_{y}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho} \right){\Large{\mid}}_{\scriptsize{y+\Delta y}}-\rho v_{y}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho}{\Large\mid}_{y} \right) \right]\Delta x\Delta z+ \\  
\scriptsize\left[ \rho v_{z}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho} \right){\Large{\mid}}_{\scriptsize{z+\Delta z}}-\rho v_{z}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho}{\Large\mid}_{z} \right) \right]\Delta x\Delta y \\  
\scriptsize\tag{16-4}\end{align}$$

I have no idea why linting broke my callout. Well, I know it's becasuse I told it to add After Lint Render: image

Source Code:

> [!axiom] All Energy Transfer Across the Control Surface due to Fluid Flow  
> $\scriptsize{{\color{red}e}+\frac{{\color{purple}P}}{\rho}=gy+\frac{v^2}{2}+u+\frac{{\color{purple}P}}{\rho}}$
>
> $$\begin{align}\scriptsize{\int\int_{C.S.}^{} {{\left( {\color{red}e}+\frac{{\color{purple}P}}{\rho}\right)}\rho{({\color{grey}\overrightarrow{ v }}*{\color{pink}\overrightarrow{ n }})}}\,{d{\color{blue}A}}}= \\

\scriptsize\left[ \rho v_{x}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho} \right){\Large{\mid}}_{\scriptsize{x+\Delta x}}-\rho v_{x}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho}{\Large\mid}_{x} \right) \right]\Delta y\Delta z+ \\  
\scriptsize\left[ \rho v_{y}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho} \right){\Large{\mid}}_{\scriptsize{y+\Delta y}}-\rho v_{y}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho}{\Large\mid}_{y} \right) \right]\Delta x\Delta z+ \\  
\scriptsize\left[ \rho v_{z}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho} \right){\Large{\mid}}_{\scriptsize{z+\Delta z}}-\rho v_{z}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho}{\Large\mid}_{z} \right) \right]\Delta x\Delta y \\  
\scriptsize\tag{16-4}\end{align}$$

Linter Config { "ruleConfigs": { "add-blank-line-after-yaml": { "enabled": false }, "escape-yaml-special-characters": { "enabled": false, "try-to-escape-single-line-arrays": false }, "force-yaml-escape": { "enabled": false, "force-yaml-escape-keys": "" }, "format-tags-in-yaml": { "enabled": false }, "format-yaml-array": { "enabled": false, "alias-key": true, "tag-key": true, "default-array-style": "single-line", "default-array-keys": true, "force-single-line-array-style": "", "force-multi-line-array-style": "" }, "insert-yaml-attributes": { "enabled": false, "text-to-insert": "aliases: \ntags: " }, "move-tags-to-yaml": { "enabled": false, "how-to-handle-existing-tags": "Nothing", "tags-to-ignore": "" }, "remove-yaml-keys": { "enabled": false, "yaml-keys-to-remove": "" }, "yaml-key-sort": { "enabled": false, "yaml-key-priority-sort-order": "", "priority-keys-at-start-of-yaml": true, "yaml-sort-order-for-other-keys": "None" }, "yaml-timestamp": { "enabled": true, "date-created": true, "date-created-key": "created", "force-retention-of-create-value": false, "date-modified": true, "date-modified-key": "updated", "format": "dddd, MMMM Do YYYY, h:mm:ss a" }, "yaml-title": { "enabled": true, "title-key": "Title", "mode": "filename" }, "yaml-title-alias": { "enabled": false, "preserve-existing-alias-section-style": true, "keep-alias-that-matches-the-filename": false, "use-yaml-key-to-keep-track-of-old-filename-or-heading": true }, "capitalize-headings": { "enabled": true, "style": "Title Case", "ignore-case-words": true, "ignore-words": "macOS, iOS, iPhone, iPad, JavaScript, TypeScript, AppleScript, I", "lowercase-words": "a, an, the, aboard, about, abt., above, abreast, absent, across, after, against, along, aloft, alongside, amid, amidst, mid, midst, among, amongst, anti, apropos, around, round, as, aslant, astride, at, atop, ontop, bar, barring, before, B4, behind, below, beneath, neath, beside, besides, between, 'tween, beyond, but, by, chez, circa, c., ca., come, concerning, contra, counting, cum, despite, spite, down, during, effective, ere, except, excepting, excluding, failing, following, for, from, in, including, inside, into, less, like, minus, modulo, mod, near, nearer, nearest, next, notwithstanding, of, o', off, offshore, on, onto, opposite, out, outside, over, o'er, pace, past, pending, per, plus, post, pre, pro, qua, re, regarding, respecting, sans, save, saving, short, since, sub, than, through, thru, throughout, thruout, till, times, to, t', touching, toward, towards, under, underneath, unlike, until, unto, up, upon, versus, vs., v., via, vice, vis-à-vis, wanting, with, w/, w., c̄, within, w/i, without, 'thout, w/o, abroad, adrift, aft, afterward, afterwards, ahead, apart, ashore, aside, away, back, backward, backwards, beforehand, downhill, downstage, downstairs, downstream, downward, downwards, downwind, east, eastward, eastwards, forth, forward, forwards, heavenward, heavenwards, hence, henceforth, here, hereby, herein, hereof, hereto, herewith, home, homeward, homewards, indoors, inward, inwards, leftward, leftwards, north, northeast, northward, northwards, northwest, now, onward, onwards, outdoors, outward, outwards, overboard, overhead, overland, overseas, rightward, rightwards, seaward, seawards, skywards, skyward, south, southeast, southwards, southward, southwest, then, thence, thenceforth, there, thereby, therein, thereof, thereto, therewith, together, underfoot, underground, uphill, upstage, upstairs, upstream, upward, upwards, upwind, west, westward, westwards, when, whence, where, whereby, wherein, whereto, wherewith, although, because, considering, given, granted, if, lest, once, provided, providing, seeing, so, supposing, though, unless, whenever, whereas, wherever, while, whilst, ago, according to, as regards, counter to, instead of, owing to, pertaining to, at the behest of, at the expense of, at the hands of, at risk of, at the risk of, at variance with, by dint of, by means of, by virtue of, by way of, for the sake of, for sake of, for lack of, for want of, from want of, in accordance with, in addition to, in case of, in charge of, in compliance with, in conformity with, in contact with, in exchange for, in favor of, in front of, in lieu of, in light of, in the light of, in line with, in place of, in point of, in quest of, in relation to, in regard to, with regard to, in respect to, with respect to, in return for, in search of, in step with, in touch with, in terms of, in the name of, in view of, on account of, on behalf of, on grounds of, on the grounds of, on the part of, on top of, with a view to, with the exception of, à la, a la, as soon as, as well as, close to, due to, far from, in case, other than, prior to, pursuant to, regardless of, subsequent to, as long as, as much as, as far as, by the time, in as much as, inasmuch, in order to, in order that, even, provide that, if only, whether, whose, whoever, why, how, or not, whatever, what, both, and, or, not only, but also, either, neither, nor, just, rather, no sooner, such, that, yet, is, it" }, "file-name-heading": { "enabled": true }, "header-increment": { "enabled": false, "start-at-h2": false }, "headings-start-line": { "enabled": false }, "remove-trailing-punctuation-in-heading": { "enabled": false, "punctuation-to-remove": ".,;:!。,;:!" }, "footnote-after-punctuation": { "enabled": false }, "move-footnotes-to-the-bottom": { "enabled": false }, "re-index-footnotes": { "enabled": false }, "auto-correct-common-misspellings": { "enabled": false, "ignore-words": "" }, "blockquote-style": { "enabled": false, "style": "space" }, "convert-bullet-list-markers": { "enabled": false }, "default-language-for-code-fences": { "enabled": false, "default-language": "" }, "emphasis-style": { "enabled": false, "style": "consistent" }, "no-bare-urls": { "enabled": false, "no-bare-uris": false }, "ordered-list-style": { "enabled": true, "number-style": "ascending", "list-end-style": ")" }, "proper-ellipsis": { "enabled": true }, "quote-style": { "enabled": false, "single-quote-enabled": true, "single-quote-style": "''", "double-quote-enabled": true, "double-quote-style": "\"\"" }, "remove-consecutive-list-markers": { "enabled": false }, "remove-empty-list-markers": { "enabled": true }, "remove-hyphenated-line-breaks": { "enabled": false }, "remove-multiple-spaces": { "enabled": true }, "strong-style": { "enabled": false, "style": "consistent" }, "two-spaces-between-lines-with-content": { "enabled": true }, "unordered-list-style": { "enabled": false, "list-style": "consistent" }, "compact-yaml": { "enabled": false, "inner-new-lines": false }, "consecutive-blank-lines": { "enabled": false }, "convert-spaces-to-tabs": { "enabled": false, "tabsize": 4 }, "empty-line-around-blockquotes": { "enabled": true }, "empty-line-around-code-fences": { "enabled": true }, "empty-line-around-math-blocks": { "enabled": false }, "empty-line-around-tables": { "enabled": true }, "heading-blank-lines": { "enabled": true, "bottom": true, "empty-line-after-yaml": true }, "line-break-at-document-end": { "enabled": false }, "move-math-block-indicators-to-their-own-line": { "enabled": true }, "paragraph-blank-lines": { "enabled": true }, "remove-empty-lines-between-list-markers-and-checklists": { "enabled": false }, "remove-link-spacing": { "enabled": false }, "remove-space-around-characters": { "enabled": false, "include-fullwidth-forms": true, "include-cjk-symbols-and-punctuation": true, "include-dashes": true, "other-symbols": "" }, "remove-space-before-or-after-characters": { "enabled": false, "characters-to-remove-space-before": ",!?;:).’”]", "characters-to-remove-space-after": "¿¡‘“([" }, "space-after-list-markers": { "enabled": true }, "space-between-chinese-japanese-or-korean-and-english-or-numbers": { "enabled": false }, "trailing-spaces": { "enabled": false, "twp-space-line-break": false }, "add-blockquote-indentation-on-paste": { "enabled": true }, "prevent-double-checklist-indicator-on-paste": { "enabled": false }, "prevent-double-list-item-indicator-on-paste": { "enabled": true }, "proper-ellipsis-on-paste": { "enabled": false }, "remove-hyphens-on-paste": { "enabled": false }, "remove-leading-or-trailing-whitespace-on-paste": { "enabled": false }, "remove-leftover-footnotes-from-quote-on-paste": { "enabled": false }, "remove-multiple-blank-lines-on-paste": { "enabled": false } }, "lintOnSave": false, "recordLintOnSaveLogs": false, "displayChanged": true, "lintOnFileChange": true, "displayLintOnFileChangeNotice": false, "settingsConvertedToConfigKeyValues": true, "foldersToIgnore": [ "Templates" ], "linterLocale": "system-default", "logLevel": "ERROR", "lintCommands": [ { "id": "", "name": "" }, { "id": "", "name": "" } ], "customRegexes": [], "commonStyles": { "aliasArrayStyle": "single-line", "tagArrayStyle": "single-line", "minimumNumberOfDollarSignsToBeAMathBlock": 2, "escapeCharacter": "\"", "removeUnnecessaryEscapeCharsForMultiLineArrays": false } }

pjkaufman commented 9 months ago

Hey @LynetteCullens . I think it should be adding lines with a > at the start for callouts. However it depends how mangled the line it tries to work on.

The example looks pretty complex as is. Is this reproducible with a simpler math equation?

LynetteCullens commented 9 months ago

Hey @LynetteCullens . I think it should be adding lines with a > at the start for callouts. However it depends how mangled the line it tries to work on.

The example looks pretty complex as is. Is this reproducible with a simpler math equation?

I tried it in a sandbox vault, granted, I copied over all of my plugins because math is not native to callouts. A majority of my plugins are dependent on one another. I got the same results linter

pjkaufman commented 8 months ago

@LynetteCullens , I took a look at the math syntax in question and it looks like the Linter does not support the syntax you are using. If you look at the ast explorer here, you may notice that the math block ends at the first instance of \\ since the blockquote is not continued onto the next line.

If you use the following for your math block it should fix the issue with the math block not getting properly recognized which I believe is causing your issue:

> [!axiom] All Energy Transfer Across the Control Surface due to Fluid Flow  
> $\scriptsize{{\color{red}e}+\frac{{\color{purple}P}}{\rho}=gy+\frac{v^2}{2}+u+\frac{{\color{purple}P}}{\rho}}$
> $$\begin{align}\scriptsize{\int\int_{C.S.}^{} {{\left( {\color{red}e}+\frac{{\color{purple}P}}{\rho}\right)}\rho{({\color{grey}\overrightarrow{ v }}*{\color{pink}\overrightarrow{ n }})}}\,{d{\color{blue}A}}}= \\
> \scriptsize\left[ \rho v_{x}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho} \right){\Large{\mid}}_{\scriptsize{x+\Delta x}}-\rho v_{x}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho}{\Large\mid}_{x} \right) \right]\Delta y\Delta z+ \\  
> \scriptsize\left[ \rho v_{y}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho} \right){\Large{\mid}}_{\scriptsize{y+\Delta y}}-\rho v_{y}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho}{\Large\mid}_{y} \right) \right]\Delta x\Delta z+ \\  
> \scriptsize\left[ \rho v_{z}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho} \right){\Large{\mid}}_{\scriptsize{z+\Delta z}}-\rho v_{z}\left( \frac{v^2}{2}+gy+u+\frac{P}{\rho}{\Large\mid}_{z} \right) \right]\Delta x\Delta y \\  
> \scriptsize\tag{16-4}\end{align}$$

I am not sure how other plugins or Obsidian will treat that blockquote/callout though.

pjkaufman commented 6 months ago

Hey @LynetteCullens , I believe that #1017 requests a feature that would fix this issue. But in summary, the problem is that the math format you are using is not the same one the parser that the Linter uses. This means that while it may work fine in Obsidian, the Linter does not identify it as a math block in a blockquote. Thus you see modifications that may break things for Obsidian.

Unless there are further questions or comments around this, I plan to close this issue on the 5th.

LynetteCullens commented 6 months ago

Hey @LynetteCullens , I believe that #1017 requests a feature that would fix this issue. But in summary, the problem is that the math format you are using is not the same one the parser that the Linter uses. This means that while it may work fine in Obsidian, the Linter does not identify it as a math block in a blockquote. Thus you see modifications that may break things for Obsidian.

Unless there are further questions or comments around this, I plan to close this issue on the 5th.

Oh yeah. Feel free to close it. Thank you.