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
- https://talk.commonmark.org/t/possible-bug-of-list-and-blockquote/2025/2
- https://talk.commonmark.org/t/why-is-the-blockquote-split-into-two-in-this-case/879
- https://talk.commonmark.org/t/blockquotes-could-spec-require-strict-indent-before-after/984/3
- https://talk.commonmark.org/t/blockquotes-whitespace-after/2956
- https://talk.commonmark.org/t/fenced-blockquote/2370
- https://discourse.wicg.io/t/proposal-allow-scrolling-to-a-specified-text-snippet-in-a-navigation/3442
- https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url
- https://discourse.wicg.io/t/html-quotation-and-citation-elements-from-fragmented-texts/5918
- https://talk.commonmark.org/t/rfc-spec-extension-for-tables-syntax-and-transformation-rules/1910
- https://commonmark.org/help/tutorial/05-blockquotes.html
- https://talk.commonmark.org/t/project-ann-rfc-extending-and-using-commonmark-in-new-ways/1896
- https://github.com/WICG/scroll-to-text-fragment
- https://commonmark.org/help/tutorial/05-blockquotes.html
- https://www.markdownguide.org/basic-syntax/
- https://davidwells.io/snippets/regex-match-markdown-links
- https://medium.com/@michael_perrin/match-markdown-links-with-advanced-regex-features-fc5f9f4122bc
- https://stackoverflow.com/questions/37462126/regex-match-markdown-link
- https://stackoverflow.com/questions/28391298/how-do-i-define-a-regex-that-will-match-blockquotes-in-markdown
- https://dev.to/davidwells/regex-to-match-markdown-links-in-javascript-472h
- https://www.w3schools.io/file/markdown-blockquotes/
- https://stackoverflow.com/questions/28391298/how-do-i-define-a-regex-that-will-match-blockquotes-in-markdown
- https://dev.to/davidwells/regex-to-match-markdown-links-in-javascript-472h
- https://stackoverflow.com/questions/37462126/regex-match-markdown-link
- https://stackoverflow.com/questions/2002120/citing-the-author-of-a-blockquote-using-markdown-syntax
- https://web.dev/text-fragments/
- https://datatracker.ietf.org/doc/html/rfc3778#section-3
- https://www.w3.org/TR/media-frags/#media-fragment-syntax