Skip to content

Commit

Permalink
Update Remark packages
Browse files Browse the repository at this point in the history
  • Loading branch information
ocavue committed Oct 21, 2023
1 parent 3f528f3 commit 0936c15
Show file tree
Hide file tree
Showing 5 changed files with 459 additions and 441 deletions.
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,16 @@
"date-fns": "^2.29.3",
"jsdom": "^20.0.3",
"lodash-es": "^4.17.21",
"mdast-util-find-and-replace": "^2.2.2",
"mdast-util-gfm-autolink-literal": "^1.0.2",
"mdast-util-to-string": "^3.1.0",
"micromark-extension-gfm-autolink-literal": "^1.0.3",
"rehype-stringify": "^9.0.3",
"remark-parse": "^10.0.1",
"remark-rehype": "^10.1.0",
"remark-wiki-link": "^1.0.4",
"unified": "^10.1.2",
"unist-util-visit": "^4.1.1",
"mdast-util-find-and-replace": "^3.0.1",
"mdast-util-gfm-autolink-literal": "^2.0.0",
"mdast-util-to-string": "^4.0.0",
"micromark-extension-gfm-autolink-literal": "^2.0.0",
"rehype-stringify": "^10.0.0",
"remark-parse": "^11.0.0",
"remark-rehype": "^11.0.0",
"remark-wiki-link": "^2.0.1",
"unified": "^11.0.3",
"unist-util-visit": "^5.0.0",
"urlpattern-polyfill": "^6.0.2",
"zod": "^3.21.4"
},
Expand All @@ -50,10 +50,11 @@
"@size-limit/preset-small-lib": "^8.1.0",
"@types/js-yaml": "^4.0.5",
"@types/lodash-es": "^4.17.6",
"@types/prettier": "^2.0.0",
"@types/wicg-file-system-access": "^2020.9.6",
"bumpp": "^9.1.0",
"eslint": "^8.28.0",
"prettier": "^2.8.0",
"prettier": "^2.8.8",
"size-limit": "^8.1.0",
"tsup": "^6.5.0",
"typescript": "^4.9.3",
Expand Down
9 changes: 6 additions & 3 deletions src/convertors/roam/roam-backlinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ export class RoamBacklinks {
// We want to iterate deeply through the note and map
// all the titles to their corresponding note IDs.
private processNote(note: RoamNote, result: TitleToIdMap = new Map()) {
this.titleToIdMap.set(note.title, normalizeUidToId(note.uid))
this.idToTitleMap.set(normalizeUidToId(note.uid), note.title)
const id = normalizeUidToId(note.uid)
const title = note.title || id

Check warning on line 43 in src/convertors/roam/roam-backlinks.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 14.x and ubuntu-latest

Delete `·`

this.titleToIdMap.set(title, id)
this.idToTitleMap.set(id, title)

if (note.children) {
note.children.map((child) => {
Expand All @@ -64,7 +67,7 @@ export class RoamBacklinks {

// We are treating noteString.uid as the block ref title
this.titleToIdMap.set(noteString.uid, normalizeUidToId(note.uid))
this.idToTitleMap.set(normalizeUidToId(noteString.uid), note.title)
this.idToTitleMap.set(normalizeUidToId(noteString.uid), note.title || "")

Check warning on line 70 in src/convertors/roam/roam-backlinks.ts

View workflow job for this annotation

GitHub Actions / Build, lint, and test on Node 14.x and ubuntu-latest

Replace `""` with `''`

if (noteString.children) {
noteString.children.map((child) => {
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/markdown/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export const markdownToHtml = (

const processor = unified()
.data('micromarkExtensions', [
gfmAutolinkLiteral,
gfmAutolinkLiteral(),
{disable: {null: constructsToDisable}},
])
.data('fromMarkdownExtensions', [gfmAutolinkLiteralFromMarkdown])
.data('fromMarkdownExtensions', [gfmAutolinkLiteralFromMarkdown()])
.use(pipeToMarkdown)
.use(wikiLinkPlugin, {
wikiLinkClassName: 'backlink',
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/markdown/plugins/parse-tags.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {type Root, type StaticPhrasingContent} from 'mdast'
import {type Root, type PhrasingContent} from 'mdast'
import {findAndReplace, type ReplaceFunction} from 'mdast-util-find-and-replace'
import {Plugin} from 'unified'

Expand Down Expand Up @@ -26,7 +26,7 @@ export const parseTags: Plugin<[ParseTagOptions], Root> = (options: ParseTagOpti

const url = buildTagUrl({graphId: options.graphId, linkHost: options.linkHost, tag})

const node: StaticPhrasingContent = {type: 'text', value}
const node: PhrasingContent = {type: 'text', value}

return {type: 'link', title: null, url, children: [node]}
}
Expand Down
Loading

0 comments on commit 0936c15

Please sign in to comment.