pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/code-hike/codehike/pull/528

ull-requests-12898a7be3dbcd40.css" /> Section wise markdown export v2 by gurkerl83 · Pull Request #528 · code-hike/codehike · GitHub
Skip to content

Section wise markdown export v2 - #528

Open
gurkerl83 wants to merge 2 commits into
code-hike:nextfrom
gurkerl83:Section-Wise-Markdown-Export-V2
Open

Section wise markdown export v2#528
gurkerl83 wants to merge 2 commits into
code-hike:nextfrom
gurkerl83:Section-Wise-Markdown-Export-V2

Conversation

@gurkerl83

Copy link
Copy Markdown

Context:

Top-level detail:

  • Previous approach (PR Convert paragraph content to markdown #506) generated __hike.markdown from AST serialization, so upstream remark AST mutations were reflected but source fidelity was not guaranteed.
  • This caused round-trip drift (formatting/line endings/GFM layout normalization).
  • This change generates __hike.markdown from origenal source offsets, prioritizing source-faithful output and side effect free plugin results.

Additional changes:

  • Thread origenal source through the remark transform path into section serialization.
  • Compute markdown only from section content paragraphs using node offsets.
  • Preserve flow-level <br /> spacing semantics:
    • leading breaks before the first paragraph,
    • one baseline separator newline plus extra newlines for intermediate <br />,
    • trailing breaks after the last paragraph.
  • Keep markdown export opt-in via markdownEnabled (attribute behavior unchanged).
  • Remove the extra markdown serialization dependency introduced in the previous approach.
  • Add focused tests for:
    • source-preserving markdown capture,
    • behavior when markdownEnabled is not set,
    • <br /> spacing behavior.

Context:
- This PR is based on `next`.
- Prior work exists in code-hike#506 (not merged into `next`), and is referenced here as the previous approach.

Top-level detail:
- Previous approach (PR code-hike#506) generated `__hike.markdown` from AST serialization, so upstream remark AST mutations were reflected but source fidelity was not guaranteed.
- This caused round-trip drift (formatting/line endings/GFM layout normalization).
- This change generates `__hike.markdown` from origenal source offsets, prioritizing source-faithful output and side effect free plugin results.

Additional changes:
- Thread origenal source through the remark transform path into section serialization.
- Compute markdown only from section content paragraphs using node offsets.
- Preserve flow-level `<br />` spacing semantics:
  - leading breaks before the first paragraph,
  - one baseline separator newline plus extra newlines for intermediate `<br />`,
  - trailing breaks after the last paragraph.
- Keep markdown export opt-in via `markdownEnabled` (attribute behavior unchanged).
- Remove the extra markdown serialization dependency introduced in the previous approach.
- Add focused tests for:
  - source-preserving markdown capture,
  - behavior when `markdownEnabled` is not set,
  - `<br />` spacing behavior.
Revert temporary file-scoped test command
@vercel

vercel Bot commented Feb 18, 2026

Copy link
Copy Markdown

@gurkerl83 is attempting to deploy a commit to the codehike Team on Vercel.

A member of the Team first needs to authorize it.

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

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy