-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE]: Can add a plain text view? #73
Comments
Thanks for opening the issue! This problem occurs because the extension system (which the plugin works on) reads the .TXT file into the .MD text renderer. There is currently no solution for this issue, so I plan to integrate a full-fledged syntax highlighting system and a "code editor" based on "Monaco Editor" technology, since CM (Codemirrors) has long ceased to support the functionality of its own renderer. In the near future, I plan to start developing this integration, the progress can be checked in the branch: |
Rendering "txt", "yml", "csv" and all file types as plain text in Obsidian, using UNITADEI use a trick to render "txt", "yaml" (yml) and "csv" files as plain text. Step 1I installed UNITADE as usual, then defined txt, yml and csv as extensions: At this point comments in yml files are rendered as H1/2/3 headers which we want to prevent... Step 2Then I created a CSS snippet file, put it under "snippets" folder, and enabled it in Appearance settings: Here is /* Note: This trick will not work when you have split view */
/* ============================ YML ============================ */
/* IF left menu (mod-left-split) has an active file with "yml" extension */
.mod-left-split:has( .nav-file-title.is-active[data-path$="yml"] )
/* THEN its sibling (mod-root) will have overriden CSS rules */
~ .mod-root .workspace-leaf-content .cm-content * {
color: var(--code-normal);
font-size: var(--font-text-size);
font-family: var(--font-monospace);
font-weight: normal;
}
/* IF left menu (mod-left-split) has an active file with "yml" extension */
.mod-left-split:has( .nav-file-title.is-active[data-path$="yml"] )
/* THEN its sibling (mod-root) will have overriden CSS rules */
~ .mod-root .workspace-leaf-content .cm-header {
color: var(--text-accent);
} End resultThis is the result: Notes:
|
@ZSkycat for preventing #tags becoming a rounded chip, you can add: /* IF left menu (mod-left-split) has an active file with "txt" extension */
.mod-left-split:has( .nav-file-title.is-active[data-path$="txt"] )
/* THEN its sibling (mod-root) will have overriden CSS rules */
~ .mod-root .workspace-leaf-content .cm-hashtag {
padding: 0;
background: none;
} |
Didn't expect to see such a unique use of my plugin, thanks for the help, @pemre! The plugin once attempted to implement a custom renderer using Codemirrors and CSS styles, but was unsuccessful. @ZSkycat, purely technically, the dev version of the plugin already has the ability to work with the source code, but it requires polishing and may be "broken" on other devices. Thanks for waiting for the release. |
Read more about new release related to this issue: |
Thanks for the update! JFYI, we can't update it. Update button gives "Failedd to install" error. I uninstalled, restarted app and tried to install; still having the same error. Now I lost the previous version too 😅 :/ |
The mistake was that I made a release using standard normalized semantics (starting at v*), OBSIDIAN does not accept this. The problem is fixed, please try again. |
Thanks. I just installed. I observed some confusing issues:
But actually only ">" greater/closing-tag works. 😕 E.g. "txt> csv> yml" Also: Any attempt of using comma or semicolon triggers not only one but tens of notifications in the system tray. And I couldn't make it use any code editor yet. I still see bare markdown editor's view. |
Forgot about README, will fix.
Also would edit, my bad.
This is a common problem, it is discussed in the issue #70, it occurs because OBSIDIAN doesn't allow me to read "input" of user as final and I have to "castrate" the input in such formations. You can read wiki's page about silencing errors, it's functionality is down below in the settings page:
|
Because I installed the plugin, set up, for example, this config ( {
"markdown_overcharge": false,
"extensions": "txt",
"is_case_insensitive": false,
"is_onload": false,
"is_onload_unsafe": false,
"forced_extensions": "",
"is_ignore": false,
"ignore_extensions": "",
"ignore_masks": "",
"is_grouped": false,
"grouped_extensions": "",
"mobile_settings": {
"enable": false,
"extensions": "txt",
"stable": true
},
"barefiling": true,
"stable": true,
"errors": {
"": "Error from UNITADE plugin: Error: Attempting to register an existing view type \"\""
},
"debug_mode": true,
"silence_errors": true,
"manifest_version": "",
"compatibility_module": true,
"code_editor_settings": {
"enabled": true,
"use_default_extensions": false,
"extensions": "dart> txt> yaml",
"folding": true,
"line_numbers": true,
"word_wrapping": false,
"minimapping": true,
"validation_semantic": true,
"validation_syntax": true,
"theme": "AUTO",
"font_size": 14,
"font_family": "'Cascadia Code', 'Fira Code', Consolas, 'Courier New', monospace",
"font_ligatures": true
},
"SYS_FONTSIZE_MAX": 32,
"SYS_FONTSIZE_MIN": 5
} |
It worked with your config, thanks! "use_default_extensions" was true... Making it false did the trick, I think... I also changed debug mode and silence errors, but I don't think that they are responsible. |
Last two are just for convenience, first one: it's an interesting problem related to OBSIDIAN and my settings, I'll also add it on my radar. Thanks for "early-testing" my plugin! From this dialog, we got:
|
Information about semantics of plugin was stale (using comma as separated and other): updated this, also add link to the wikipedia. Part of fixes from #73
…s appear null This things occurs because different language may not contain specified elements, for example, translation for code editor font size and etc. Part of fixes from #73
…d in settings tab Error was defined by case, when "use default extensions" was enabled, but extensions input was NOT hidden. Part of fixes from #73
Sorry for being a dunce but I have yet to understand what I have to do to view a .txt file without any formatting applied to it. |
Use "code editor module" from "v3.*" version of plugin, you can either turn on "use default extensions" (it would use extensions from "extensions" setting block) or type custom extensions in it. It would open files as code files (like in any code editor), more advanced instruction:
txt
More about extensions, code editor and etc. read at the wiki: |
@Falcion iirc that was the default setup when I downloaded the extension, so there wasn't anything I could change. |
Now I understand what you are talking about, unfortunately I can't do anything about this problem: it is "installed" on the editor side of the Monaco Editor technology (the same one that VS Code uses, in which a similar problem occurs sometimes, I checked it myself). Maybe in theory there really is a solution, but I don't know about it, unfortunately: you can try the solution proposed in this discussion by installing CSS styles (via snippet) and rendering the file via just OBSIDIAN. Note I know this is not the best solution, but you can use "PITCH-LIGHT" theme, it doesn't show any validations errors like this. |
Yeah I should've been clearer about what I was trying 2 do. |
Contact details
No response
What the essence of your feature request
Plain text will be rendered as markdown in reading view.
I want it to be displayed as plain text.
In txt file:
In reading view:
On what OS you want to maintain your request.
Windows
Code of conduct
Issue policy
The text was updated successfully, but these errors were encountered: