Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
Update to CM6 and various other items that work to various degrees
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarenholz committed Jun 6, 2023
1 parent 0ebdf9a commit 2c30a6e
Show file tree
Hide file tree
Showing 21 changed files with 1,090 additions and 533 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# top-most EditorConfig file
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 4
tab_width = 4
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/

main.js
23 changes: 23 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"env": { "node": true },
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
"@typescript-eslint/ban-ts-comment": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off"
}
}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# vscode
.vscode

# Intellij
*.iml
.idea
Expand All @@ -12,3 +15,6 @@ main.js

# obsidian
data.json

# Exclude macOS Finder (System Explorer) View States
.DS_Store
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tag-version-prefix=""
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Daniel Barenholz
Copyright (c) 2022-2023 Daniel Barenholz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
36 changes: 22 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Plaintext for Obsidian

This is an [Obisidan](https://obsidian.md) plugin that allows you to open _any_ file as plaintext.
It has been developed for Obsidian **v0.13.14**, and tested on **Windows**.
It has been developed for Obsidian **v1.3.5**, and tested on **Windows**.

Honestly, as long as you can run any Obsidian version you can _probably_ run this plugin as well.
The only requirements are that we can register extensions (this existed in v0.12.12 for instance), and that the `viewRegistry` exists, which I'm assuming has been there since the beginning of Obsidian.
Expand All @@ -17,7 +17,7 @@ Since 0.2.0 by default you can no longer accidentally break other plugins with v
## Installing

Interested in editing files in Obsidian? Great.
Grab the latest release from the [releases](#) page, and copy `main.js` and `manifest.json` to `.obsidian/plugins/obsidian-plaintext/`. That's it!
Grab the latest release from the [releases](https://github.com/dbarenholz/obsidian-plaintext/releases) page, and copy `main.js` and `manifest.json` to `.obsidian/plugins/obsidian-plaintext/`. That's it!

You can also install the plugin through Obsidian by searching for **plaintext**.

Expand All @@ -35,25 +35,33 @@ This is free. Keep your money, I don't want it.

## Changelog

**Version 0.2.0 (current)**:
**Version 0.3.0 (current)**:

- Long overdue: plugin is enabled for mobile!
- Extra protection: by default, extensions that other plugins add (such as .csv) are not allowed anymore!
- We have over 500 downloads!
- Rewrite to use CM6 in stead of CM5. A first step towards https://github.com/dbarenholz/obsidian-plaintext/issues/1.
- Fixed https://github.com/dbarenholz/obsidian-plaintext/issues/5 by upgrading to CM6.
- Fixed https://github.com/dbarenholz/obsidian-plaintext/issues/11 - shame on me for getting the logic wrong.
- Possibly implement https://github.com/dbarenholz/obsidian-plaintext/issues/7? I don't have Obsidian on my phone, so let me know :).


**Version 0.2.0**:

- Long overdue: plugin is enabled for mobile!
- Extra protection: by default, extensions that other plugins add (such as .csv) are not allowed anymore!
- We have over 500 downloads!

**Version 0.1.0**:

- Complete rewrite of registering and deregistering.
- Now _actually_ removes views when deregistering a particular extension.
- Correctly filters out default obsidian extensions: No more accidentally overwriting the default markdown editor.
- Complete rewrite of registering and deregistering.
- Now _actually_ removes views when deregistering a particular extension.
- Correctly filters out default obsidian extensions: No more accidentally overwriting the default markdown editor.

**Version 0.0.2**:

- First actual release.
- Code is functional! You can open and edit files as plaintext.
- First actual release.
- Code is functional! You can open and edit files as plaintext.

**Version 0.0.1**:

- Not a release.
- Initial testing code.
- This included the functionality for parsing user-inputted extensions.
- Not a release.
- Initial testing code.
- This included the functionality for parsing user-inputted extensions.
60 changes: 60 additions & 0 deletions esbuild.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import esbuild from "esbuild";
import process from "process";
import builtins from "builtin-modules";

const banner = `/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
`;

const prod = process.argv[2] === "production";

const context = await esbuild.context({
banner: {
js: banner,
},
entryPoints: ["./src/main.ts"],
bundle: true,
external: [
"obsidian",
"codemirror",
"@codemirror/autocomplete",
"@codemirror/closebrackets",
"@codemirror/collab",
"@codemirror/commands",
"@codemirror/comment",
"@codemirror/fold",
"@codemirror/gutter",
"@codemirror/highlight",
"@codemirror/history",
"@codemirror/language",
"@codemirror/lint",
"@codemirror/matchbrackets",
"@codemirror/panel",
"@codemirror/rangeset",
"@codemirror/rectangular-selection",
"@codemirror/search",
"@codemirror/state",
"@codemirror/stream-parser",
"@codemirror/text",
"@codemirror/tooltip",
"@codemirror/view",
"@lezer/common",
"@lezer/lr",
...builtins,
],
format: "cjs",
target: "es2018",
logLevel: "info",
sourcemap: prod ? false : "inline",
treeShaking: true,
outfile: "main.js",
});

if (prod) {
await context.rebuild();
process.exit(0);
} else {
await context.watch();
}
6 changes: 3 additions & 3 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"id": "obsidian-plaintext",
"name": "Plaintext",
"version": "0.2.0",
"minAppVersion": "0.13.14",
"description": "Allow opening specified files as plaintext (RAW mode).",
"version": "0.3.0",
"minAppVersion": "0.15.9",
"description": "Open any file as if it was plaintext directly in Obsidian.",
"author": "dbarenholz",
"authorUrl": "https://github.com/dbarenholz/dbarenholz",
"isDesktopOnly": false
Expand Down
28 changes: 15 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
{
"name": "obsidian-plaintext",
"version": "0.2.0",
"description": "Allow opening specified files as plaintext.",
"version": "0.3.0",
"description": "Open any file as if it was plaintext directly in Obsidian.",
"main": "main.js",
"scripts": {
"dev": "rollup --config rollup.config.js -w",
"build": "rollup --config rollup.config.js --environment BUILD:production"
"dev": "node esbuild.config.mjs",
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
"version": "node version-bump.mjs && git add manifest.json versions.json"
},
"keywords": [],
"author": "dbarenholz",
"license": "MIT",
"dependencies": {
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-node-resolve": "^13.1.1",
"@rollup/plugin-typescript": "^8.3.0",
"@types/node": "^17.0.4",
"codemirror": "^5.65.0",
"obsidian": "^0.13.11",
"rollup": "^2.62.0",
"tslib": "^2.3.1",
"typescript": "^4.5.4"
"@codemirror/lang-python": "^6.1.2",
"@types/node": "^16.11.6",
"@typescript-eslint/eslint-plugin": "5.29.0",
"@typescript-eslint/parser": "5.29.0",
"builtin-modules": "3.3.0",
"codemirror": "^6.0.1",
"esbuild": "0.17.3",
"obsidian": "latest",
"tslib": "2.4.0",
"typescript": "4.7.4"
}
}
25 changes: 0 additions & 25 deletions rollup.config.js

This file was deleted.

Loading

0 comments on commit 2c30a6e

Please sign in to comment.