1. feature-name
Proposal to allow specifying a text snippet in a URL fragment inside blockquotes in CommonMarkdown
2. feature-description
2.1 Overview
Nearly all Markdown applications support the basic syntax outlined in the original Markdown design document. There are minor variations and discrepancies between Markdown processors — those are noted inline wherever possible.
2.2 proposal
Proposal to allow specifying a text snippet in a URL fragment inside blockquotes in CommonMarkdown
2.3 concept/idea/draft syntax
// context |-------match-----| context
:~:text=[prefix-,]textStart[,textEnd][,-suffix]
2.3.1 sample
https://example.com#:~:text=prefix-,startText,endText,-suffix
3. syntax, tags: ‘syntax’, ‘demo’, ‘algorithm’, ‘regex’, ‘constants’, ‘js’
const blockquote = (^> ?.+?)((\r?\n\r?\n\w)|\Z)
// syntax: '>', sample: > text
const pattern = /!?\[(.+)?\]\(((https?:\/\/)?[A-Za-z0-9\:\/\. ]+)(\"(.+)\")?\)/gm
// syntax: '[]()', sample: [text](url)
const textSnippetUrl = :~:text=[prefix-,]textStart[,textEnd][,-suffix]
3.1. demo: blockquote in Commonmark ‘before’
> Dorothy followed her through many of the beautiful rooms in her castle.
3.2 demo: blockquote in Commonmark with cite/text-fragments ‘after’
> [cite](https://dorothy.sample.net/blog/blogtest/#:~:text=blogtest,blogtest2)
// output: Dorothy followed her through many of the beautiful rooms in her castle.
4. Questions
- An important and interesting question: is it possible to use text fragments in CommonMarkdown?
- Is it possible to have a new syntax for what I’m asking for?
- Why?
- “If Commonmark start using the blockquote with attribute url and text-fragment… This allow users to navigate to the page that contains the quote.”
- “This can help the WIGC community and the Commonmark community”
- “Innovative feature”
- “I would like to HTML Quotation and Citation Elements from fragmented texts”
- To create a blockquote, add a
>
in front of a paragraph. But there is no possibility to add a fragmented cite.
5. Input/Output or ‘rules’
5.1 input
> This is blockquote text
5.1.2 output
<blockquote>
<p>This is blockquote text</p>
</blockquote>
5.2 input
> [cite](https://oleb.net/2020/swift-docker-linux/#:~:text=running,container)
5.2.1 output
<blockquote cite="https://oleb.net/2020/swift-docker-linux/#:~:text=running,container">
<p>This is blockquote text</p>
</blockquote>
6. Security/Problem/Notes
- If the quoted website removed the quoted text, that would break this feature. Note 1: This issue can occur when you quote something on some outside website or server., Note 2: This feature is great on local files like Obsidian, Dendron, Notion etc. Because you can have a central files, it’s easy to find various types of documents with this.
- I think the quoted text should be included directly in the HTML document.
7. References
- Possible Bug of List and Blockquote - #2 by jgm
- Why is the blockquote split into two in this case?
- Blockquotes - could spec require strict indent before/after ">"? - #3 by vitaly
- Blockquotes - whitespace after `>`
- Fenced blockquote
- [Proposal] Allow scrolling to a specified text snippet in a navigation - HTML - WICG
- javascript - What is a good regular expression to match a URL? - Stack Overflow
- HTML Quotation and Citation Elements from fragmented texts - HTML - WICG
- RFC Spec extension for *tables*: Syntax and transformation rules
- Markdown Tutorial - Blockquotes
- Project ANN+RFC: Extending and using CommonMark in new ways
- GitHub - WICG/scroll-to-text-fragment: Proposal to allow specifying a text snippet in a URL fragment
- Markdown Tutorial - Blockquotes
- Basic Syntax | Markdown Guide
- Regex to match markdown links - David Wells
- Match Markdown links with advanced regex features | by Michaël Perrin | Medium
- javascript - Regex match markdown link - Stack Overflow
- How do I define a Regex that will match blockquotes in Markdown? - Stack Overflow
- Regex to match markdown links in Javascript - DEV Community
- https://www.w3schools.io/file/markdown-blockquotes/
- How do I define a Regex that will match blockquotes in Markdown? - Stack Overflow
- Regex to match markdown links in Javascript - DEV Community
- javascript - Regex match markdown link - Stack Overflow
- citations - Citing the author of a blockquote using Markdown syntax - Stack Overflow
- Boldly link where no one has linked before: Text Fragments
- RFC 3778 - The application/pdf Media Type
- Media Fragments URI 1.0 (basic)