xoofx / xoofx/markdig

Translate position from rendered HTML to markdown

Open
#770 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
C#
Stars
5.3k
Forks
510
Avg merge
8d 5h
Merged PRs (30d)
5

Description

Hello, I have the following usecase:

I have an editor that can edit the rendered html (after parsing the markdown). I want to get the correct MarkdownObject for the rendered html in my editor. The cursor position from the editor is slighty off, due to missing characters from the original markdown, which are not rendered. Here is an example:

image

The cursor is at position 25, the Block that gets returned from FindBlockAtPosition returns the previous bloc with a span from 0-24.

How should i go about translating the UI position to the original markdown position?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining FindBlockAtPosition, MarkdownObject spans, and how rendered HTML positions differ from the original Markdown. Define how a rendered cursor position should map to the correct source MarkdownObject, including omitted Markdown characters; done means the reported object and span match the editor position in the provided example.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.