Skip to content

Change all fields of Element to references - #13

Merged
letmutex merged 1 commit into
mainfrom
ref-element-fields
Jun 26, 2024
Merged

letmutex merged 1 commit into
mainfrom
ref-element-fields

Conversation

@letmutex

Copy link
Copy Markdown
Owner

This avoids unnecessary clones and gave us ~4% performance improvement in some cases.

@letmutex
letmutex merged commit c174eda into main Jun 26, 2024
@letmutex
letmutex deleted the ref-element-fields branch June 26, 2024 13:18
timonv referenced this pull request in bosun-ai/swiftide Jun 28, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [htmd](https://togithub.com/letmutex/htmd) | dependencies | patch |
`0.1.3` -> `0.1.5` |

---

### Release Notes

<details>
<summary>letmutex/htmd (htmd)</summary>

### [`v0.1.5`](https://togithub.com/letmutex/htmd/releases/tag/v0.1.5)

[Compare
Source](https://togithub.com/letmutex/htmd/compare/v0.1.4...v0.1.5)

#### What's Changed

- Change all fields of Element to references by
[@&#8203;letmutex](https://togithub.com/letmutex) in
[https://github.com/letmutex/htmd/pull/13](https://togithub.com/letmutex/htmd/pull/13)
- Support resolving code block language from pre tag by
[@&#8203;letmutex](https://togithub.com/letmutex) in
[https://github.com/letmutex/htmd/pull/15](https://togithub.com/letmutex/htmd/pull/15)

**Full Changelog**:
letmutex/htmd@v0.1.4...v0.1.5

### [`v0.1.4`](https://togithub.com/letmutex/htmd/releases/tag/v0.1.4)

[Compare
Source](https://togithub.com/letmutex/htmd/compare/v0.1.3...v0.1.4)

#### What's Changed

- Add a benchmark for `convert()` by
[@&#8203;letmutex](https://togithub.com/letmutex) in
[https://github.com/letmutex/htmd/pull/9](https://togithub.com/letmutex/htmd/pull/9)
- Optimize string concatenation, this makes htmd **~20%** faster! by
[@&#8203;letmutex](https://togithub.com/letmutex) in
[https://github.com/letmutex/htmd/pull/10](https://togithub.com/letmutex/htmd/pull/10)
- Optimize get_node_tag_name(), this makes htmd **~23%** faster! by
[@&#8203;letmutex](https://togithub.com/letmutex) in
[https://github.com/letmutex/htmd/pull/11](https://togithub.com/letmutex/htmd/pull/11)
- Handle spaces in the URL by
[@&#8203;letmutex](https://togithub.com/letmutex) in
[https://github.com/letmutex/htmd/pull/12](https://togithub.com/letmutex/htmd/pull/12)

**Full Changelog**:
letmutex/htmd@v0.1.3...v0.1.4

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/bosun-ai/swiftide).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjAuMSIsInVwZGF0ZWRJblZlciI6IjM3LjQyMC4xIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
letmutex pushed a commit that referenced this pull request Sep 3, 2026
A raw HTML inline sits inside a leaf block, and a line ending ends the block
holding it: a blank line ends a paragraph, and a single line ending ends an
ATX heading or a table row, truncating the element. Every line ending in one
is therefore written as `&#13;`/`&#10;`, which the CommonMark parser decodes
back to the line ending it replaced. This is the safe over-generalization of
the blank-line rule in unsupported_html.md, which needs it only for a blank
line.

An HTML block gains the converse exemption. `escape_html_block_blank_lines`
exists because a type 6 block ends at a blank line, but a type 1 block —
`pre`, `script`, `style`, `textarea` — ends at the line holding its closing
tag, so its blank lines can stand as they are; escaping them would rewrite
the script, stylesheet, or preformatted text itself. `TYPE_1_ELEMENTS`
names that half of `BLOCK_ELEMENTS`.

Both escapes take their argument by value and return it untouched when it
holds no line ending, which is the common case.

Co-Authored-By: Claude Opus 5 <[email protected]>
letmutex pushed a commit that referenced this pull request Sep 4, 2026
A link title and an image alt end up inside a CommonMark inline, where a
line ending ends the leaf block holding it: written literally,
`# [t](u "a<LF>b")` parses as the heading `[t](u "a` followed by the
paragraph `b")`. CommonMark recognizes character references in both places,
so each line ending becomes `&#10;`, the same encoding a raw HTML inline
gets. A lone carriage return, which `lines()` does not treat as a break,
becomes `&#13;`.

This deviates from turndown, which writes the line ending literally; four
expectations in the turndown index change to match, and the harness gains a
`<!-- line feed -->` placeholder because writing the reference into the
index would only have it decoded when the index is parsed.

Co-Authored-By: Claude Opus 5 <[email protected]>
letmutex pushed a commit that referenced this pull request Sep 9, 2026
A CommonMark link destination may not hold a line ending at all: written
literally, `a[t](u<LF><LF>v)b` is two paragraphs and no link. CommonMark
does decode a character reference there, so `<CR>` and `<LF>` are written
as `&#13;` and `&#10;`, the same encoding `normalize_title` already
applies to a title.

`escape_link_destination` moves from `anchor` to `text_util` so `img` can
use it too, replacing the `replace('(', ...)` pair which escaped the
parentheses but left the line endings. The line ending encoding itself
becomes `push_encoding_line_ending`, shared with `normalize_title`, and
`has_line_ending` moves alongside it from `element_util`.

Co-Authored-By: Claude Opus 5 <[email protected]>
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.

1 participant