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

Support <code> tags and blocks #7

Merged
merged 28 commits into from
Nov 14, 2021
Merged

Support <code> tags and blocks #7

merged 28 commits into from
Nov 14, 2021

Conversation

jfhr
Copy link
Owner

@jfhr jfhr commented Nov 12, 2021

  • deltaToHtml: convert { insert: "foo", attributes: { code: true } } objects to <code>foo</code>
  • htmlToDelta: convert <code>foo</code> to { insert: "foo", attributes: { code: true } }
  • deltaToHtml: convert { insert: "foo" }, { insert: "\n", attributes: { "code-block": true, /*...*/ } } to <pre><code>foo</code></pre>
  • htmlToDelta: convert <pre><code>foo</code></pre> to { insert: "foo" }, { insert: "\n", attributes: { "code-block": true, /*...*/ } }
  • deltaToNpf: convert { insert: "foo", attributes: { code: true } } to colored text
  • deltaToNpf: convert { insert: "\n", attributes: { "code-block": true, /*...*/ } } to chat text subtype

@jfhr jfhr self-assigned this Nov 12, 2021
@jfhr jfhr linked an issue Nov 12, 2021 that may be closed by this pull request
@jfhr
Copy link
Owner Author

jfhr commented Nov 12, 2021

Looks like npf has a chat text subtype, which is displayed in monospace font. That might be the best choice for code. See https://www.tumblr.com/docs/npf#:~:text=official%20Tumblr%20clients%20display%20this%20with%20a%20monospace%20font

@jfhr
Copy link
Owner Author

jfhr commented Nov 12, 2021

unfortunately the npf subtype chat is only for whole blocks and doesn't work inline. Might just use a red color for code instead ?

@jfhr jfhr marked this pull request as ready for review November 12, 2021 18:21
@jfhr jfhr mentioned this pull request Nov 14, 2021
@jfhr jfhr linked an issue Nov 14, 2021 that may be closed by this pull request
@jfhr jfhr changed the title Support <code> tags Support <code> tags and blocks Nov 14, 2021
@jfhr
Copy link
Owner Author

jfhr commented Nov 14, 2021

Added requirement for code blocks. Code blocks will be converted to npf chat text subtype, inline code to red colored text

@jfhr
Copy link
Owner Author

jfhr commented Nov 14, 2021

Looks like the conditional access operator foo?.bar doesn't work in node 12. should have known

@jfhr jfhr merged commit 79dfe14 into main Nov 14, 2021
@jfhr jfhr deleted the add-code branch November 14, 2021 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support code blocks Support code tags
1 participant