Skip to content

Commit

Permalink
Replace *all* runs of spaces with hyphens
Browse files Browse the repository at this point in the history
  • Loading branch information
jparise committed Nov 1, 2024
1 parent 6f248b6 commit e4ca19a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/notes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type InstapaperPlugin from "./main";
import type { InstapaperAccessToken, InstapaperBookmark, InstapaperHighlight, InstapaperTag } from "./api";

const linkSymbol = '↗';
const numericRE = /^\d+$/;

export async function syncNotes(
plugin: InstapaperPlugin,
Expand Down Expand Up @@ -114,10 +113,10 @@ function contentForHighlight(highlight: InstapaperHighlight): string {

function normalizeTag(tag: InstapaperTag): string {
// Obsidian tags cannot contain spaces.
let name = tag.name.trim().replace(/\s+/, '-');
let name = tag.name.trim().replace(/\s+/g, '-');

// Obsidian tags cannot be entirely numeric.
if (numericRE.test(name)) {
if (/^\d+$/.test(name)) {
name += "_";
}

Expand Down

0 comments on commit e4ca19a

Please sign in to comment.