Skip to content
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

0.8.1 #1806

Merged
merged 2 commits into from
Oct 6, 2023
Merged

0.8.1 #1806

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.8.1] - 2023-10-06

Updated [crossnote](https://github.com/shd101wyy/crossnote) to version [0.8.19](https://github.com/shd101wyy/crossnote/releases/tag/0.8.19).

### Changes

- Deprecated the `processWikiLink` in `parser.js`. Now `crossnote` handles how we process the wiki link.
We also added two more options:
- `wikiLinkTargetFileExtension`: The file extension of the target file. Default is `md`. For example:
- `[[test]]` will be transformed to `[test](test.md)`
- `[[test.md]]` will be transformed to `[test](test.md)`
- `[[test.pdf]]` will be transformed to `[test](test.pdf)` because it has a file extension.
- `wikiLinkTargetFileNameChangeCase`: How we transform the file name. Default is `none` so we won't change the file name.
A list of available options can be found at: https://shd101wyy.github.io/crossnote/types/WikiLinkTargetFileNameChangeCase.html

### Bug fixes

- Reverted the markdown transformer and deleted the logic of inserting anchor elements as it's causing a lot of problems.
The in-preview editor is not working as expected. So we now hide its highlight lines and elements feature if the markdown file failed to generate the correct source map.
- Fixed the bug that global custom CSS is not working.

## [0.8.0] - 2023-10-05

Updated [crossnote](https://github.com/shd101wyy/crossnote) to version [0.8.17](https://github.com/shd101wyy/crossnote/releases/tag/0.8.17) then version [0.8.18](https://github.com/shd101wyy/crossnote/releases/tag/0.8.18).
Expand Down
31 changes: 29 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "markdown-preview-enhanced",
"displayName": "%displayName%",
"version": "0.8.0",
"version": "0.8.1",
"description": "%description%",
"categories": [
"Other"
Expand Down Expand Up @@ -290,6 +290,33 @@
"default": false,
"type": "boolean"
},
"markdown-preview-enhanced.wikiLinkTargetFileExtension": {
"markdownDescription": "The file extension for the link in wikilink if the link does not have an extension.",
"default": ".md",
"type": "string"
},
"markdown-preview-enhanced.wikiLinkTargetFileNameChangeCase": {
"markdownDescription": "The case for the file name in wikilink. If the value is `none`, then the file name will not be changed. Otherwise, the file name will be transformed to the specified case. You can read https://www.npmjs.com/package/case-anything for more details.",
"default": "none",
"type": "string",
"enum": [
"none",
"camelCase",
"pascalCase",
"kebabCase",
"snakeCase",
"constantCase",
"trainCase",
"adaCase",
"cobolCase",
"dotNotation",
"pathCase",
"spaceCase",
"capitalCase",
"lowerCase",
"upperCase"
]
},
"markdown-preview-enhanced.frontMatterRenderingOption": {
"description": "Front matter rendering option",
"type": "string",
Expand Down Expand Up @@ -646,7 +673,7 @@
"@types/crypto-js": "^4.1.2",
"@types/vfile": "^3.0.2",
"async-mutex": "^0.4.0",
"crossnote": "^0.8.18",
"crossnote": "^0.8.19",
"crypto-js": "^4.1.1"
},
"devDependencies": {
Expand Down
10 changes: 10 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
PreviewMode,
PreviewTheme,
RevealJsTheme,
WikiLinkTargetFileNameChangeCase,
getDefaultNotebookConfig,
} from 'crossnote';
import { JsonObject } from 'type-fest';
Expand Down Expand Up @@ -88,6 +89,8 @@ export class MarkdownPreviewEnhancedConfig implements NotebookConfig {
public readonly jsdelivrCdnHost: string;
public readonly krokiServer: string;
public readonly alwaysShowBacklinksInPreview: boolean;
public readonly wikiLinkTargetFileExtension: string;
public readonly wikiLinkTargetFileNameChangeCase: WikiLinkTargetFileNameChangeCase;
// Don't set values for these properties in constructor:
public readonly includeInHeader: string;
public readonly globalCss: string;
Expand Down Expand Up @@ -244,6 +247,13 @@ export class MarkdownPreviewEnhancedConfig implements NotebookConfig {
this.alwaysShowBacklinksInPreview =
getMPEConfig<boolean>('alwaysShowBacklinksInPreview') ??
defaultConfig.alwaysShowBacklinksInPreview;
this.wikiLinkTargetFileExtension =
getMPEConfig<string>('wikiLinkTargetFileExtension') ??
defaultConfig.wikiLinkTargetFileExtension;
this.wikiLinkTargetFileNameChangeCase =
getMPEConfig<WikiLinkTargetFileNameChangeCase>(
'wikiLinkTargetFileNameChangeCase',
) ?? defaultConfig.wikiLinkTargetFileNameChangeCase;
}

public isEqualTo(otherConfig: MarkdownPreviewEnhancedConfig) {
Expand Down
21 changes: 13 additions & 8 deletions src/notebooks-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,19 @@ class NotebooksManager {
getWorkspaceFolderUri(uri),
'./.crossnote',
);
try {
workspaceConfig = await loadConfigsInDirectory(
workspaceConfigPath.fsPath,
notebook.fs,
createWorkspaceConfigDirectoryIfNotExists,
);
} catch (error) {
console.error(error);
if (
(await notebook.fs.exists(workspaceConfigPath.fsPath)) ||
createWorkspaceConfigDirectoryIfNotExists
) {
try {
workspaceConfig = await loadConfigsInDirectory(
workspaceConfigPath.fsPath,
notebook.fs,
createWorkspaceConfigDirectoryIfNotExists,
);
} catch (error) {
console.error(error);
}
}

// VSCode config
Expand Down
2 changes: 1 addition & 1 deletion src/preview-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ export class PreviewProvider {
useRelativeFilePath: false,
hideFrontMatter: false,
triggeredBySave,
vscodePreviewPanel: preview, // TODO:
vscodePreviewPanel: preview,
});
// check JSAndCssFiles
if (
Expand Down
14 changes: 10 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1920,10 +1920,10 @@ cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
shebang-command "^2.0.0"
which "^2.0.1"

crossnote@^0.8.18:
version "0.8.18"
resolved "https://registry.yarnpkg.com/crossnote/-/crossnote-0.8.18.tgz#806a37f6ff8627cada55ee645b9e8c1e2307479d"
integrity sha512-LvhWOU3/T6BAoDrWC/5I7XgnC/PMvKZJFyVBnrl/l5+OZtNw4QTU0jx+Q3dge2HCpER7xdApQo0ITZWER8Xm9g==
crossnote@^0.8.19:
version "0.8.19"
resolved "https://registry.yarnpkg.com/crossnote/-/crossnote-0.8.19.tgz#a92f176d665ad0fc89b3744de566ec35f4a89dce"
integrity sha512-D/QaUBJ1ApBmq1DJOHvJ3/+g/Y8kBXhvXcbnjX6zKbzEEJ1GDQYUKIYTli8sx+3fY7nJn3BMU67DiOv4Q3mh+Q==
dependencies:
"@headlessui/react" "^1.7.17"
"@heroicons/react" "^2.0.18"
Expand All @@ -1943,6 +1943,7 @@ crossnote@^0.8.18:
crypto-js "^4.1.1"
daisyui "^3.7.3"
esbuild-plugin-tailwindcss "^1.1.1"
escape-string-regexp "^5.0.0"
html-escaper "^3.0.3"
html-react-parser "^4.2.2"
imagemagick-cli "^0.5.0"
Expand Down Expand Up @@ -2969,6 +2970,11 @@ escape-string-regexp@^4.0.0:
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==

escape-string-regexp@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz#4683126b500b61762f2dbebace1806e8be31b1c8"
integrity sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==

escodegen@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17"
Expand Down