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

Desktop: Implements a patch for multimd #5815

Merged
merged 5 commits into from
Jan 9, 2022

Conversation

CalebJohn
Copy link
Collaborator

There's a bug in the multimarkdown-table library such that it isn't mapping tokens to line numbers properly and isn't correctly setting the markdown "level" (depth) of a token. This patch was originally submitted for review upstream, but as of now has not been accepted.

ref: redbug312/markdown-it-multimd-table#42

I haven't heard back yet on the upstream patch, but it's only been a day so I'm not too concerned. I've prepared this PR in case you want to get the fix into Joplin sooner, but I think it's worth waiting until at least the weekend.

There were 2 more (less critical) bugs associated with #5808, but they're being tracked separately. #5811 and redbug312/markdown-it-multimd-table#41.

There's a bug in the multimarkdown-table library such that it isn't
mapping tokens to line numbers properly and isn't correctly setting
the markdown "level" (depth) of a token. This patch was originally
submitted for review upstream, but as of now has not been accepted.

ref: redbug312/markdown-it-multimd-table#42
@laurent22
Copy link
Owner

Thanks for the fix. I forgot why I had removed all the patch-package patches but it would indeed be good if we could use them again.

Also we're doing some optimisations in Dockerfile.server so if you add a postinstall step please also modify the Dockerfile like so:

COPY --chown=$user:$user packages/fork-sax/package*.json ./packages/fork-sax/
COPY --chown=$user:$user packages/htmlpack/package*.json ./packages/htmlpack/
COPY --chown=$user:$user packages/tools/package*.json ./packages/tools/
COPY --chown=$user:$user packages/lib/package*.json ./packages/lib/
COPY --chown=$user:$user lerna.json .
COPY --chown=$user:$user tsconfig.json .

# The following have postinstall scripts so we need to copy all the files.
# Since they should rarely change this is not an issue

COPY --chown=$user:$user packages/turndown ./packages/turndown
COPY --chown=$user:$user packages/turndown-plugin-gfm ./packages/turndown-plugin-gfm
COPY --chown=$user:$user packages/fork-htmlparser2 ./packages/fork-htmlparser2
COPY --chown=$user:$user packages/renderer ./packages/renderer

# Then bootstrap only, without compiling the TypeScript files

RUN npm run bootstrap

# We have a separate step for the server files because they are more likely to
# change.

COPY --chown=$user:$user packages/server/package*.json ./packages/server/
RUN npm run bootstrapServerOnly

# Now copy the source files. Put lib and server last as they are more likely to change.

COPY --chown=$user:$user packages/fork-sax ./packages/fork-sax
COPY --chown=$user:$user packages/htmlpack ./packages/htmlpack
COPY --chown=$user:$user packages/tools ./packages/tools
COPY --chown=$user:$user packages/lib ./packages/lib
COPY --chown=$user:$user packages/server ./packages/server

@CalebJohn
Copy link
Collaborator Author

Done! Let's hope we don't discover why the patch-packages plugin was removed in the first place :)

@tessus tessus added desktop All desktop platforms infra labels Dec 6, 2021
@laurent22
Copy link
Owner

@CalebJohn, now that we use Yarn I think we should use yarn patch for this if that's ok with you. It might actually work better since it's built into the tool.

@CalebJohn
Copy link
Collaborator Author

@laurent22 I left the dockerfile changes in, but I'm not sure if they're actually needed anymore. It seems that yarn is applying the patch at a different step, so maybe not. I'll happily remove the change if necessary, but I'll leave it up to you.

@laurent22
Copy link
Owner

Probably we can indeed remove the Dockerfile changes, since there's no longer a postinstall script. Also please could you remove the package-lock file?

@CalebJohn
Copy link
Collaborator Author

Done!

I forgot that the newest dev included a migration to yarn (hence no package-lock file)! Luckily that makes it especially easy to correct :)

@laurent22
Copy link
Owner

Looks good now, thanks!

@laurent22 laurent22 merged commit 16148b2 into laurent22:dev Jan 9, 2022
@CalebJohn CalebJohn deleted the multimd-patch branch January 9, 2022 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop All desktop platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants