ttcMD: fixes issues where paragraphs are filtered despite being a valid parent,
Fixes a greedy rx from inline-code
This commit is contained in:
parent
4615f11cfa
commit
9c04f13a42
@ -45,15 +45,13 @@ export const TTCMD: FC<
|
||||
|
||||
return (
|
||||
<Suspense fallback={<Loader />}>
|
||||
{
|
||||
/* <button
|
||||
<button
|
||||
className="btn-primary"
|
||||
onClick={() =>
|
||||
navigator.clipboard.writeText(JSON.stringify(elements, null, 2))}
|
||||
>
|
||||
copy ast
|
||||
</button> */
|
||||
}
|
||||
</button>
|
||||
{hasEscapedTOC !== undefined &&
|
||||
(
|
||||
<TTCMDRenderer
|
||||
|
@ -185,7 +185,7 @@ TokenIdentifiers.set("anchor", {
|
||||
},
|
||||
});
|
||||
TokenIdentifiers.set("inline-code", {
|
||||
rx: /\s?`(.{3,}|[a-z0-9]*?)`[^`a-z0-9\n]/gi,
|
||||
rx: /\s?`(.{3,}?|[a-z0-9]*?)`[^`a-z0-9\n]/gi,
|
||||
parse(s) {
|
||||
return {
|
||||
// content: inline,
|
||||
|
@ -123,9 +123,10 @@ function filterOverlappingPBlocks(blocks: TokenMarker[]): TokenMarker[] {
|
||||
// Filter out 'p' blocks that overlap with any other block
|
||||
for (const otherBlock of blocks) {
|
||||
if (
|
||||
otherBlock !== block && (
|
||||
otherBlock !== block &&
|
||||
(
|
||||
otherBlock.start === block.start ||
|
||||
otherBlock.end === block.end
|
||||
(otherBlock.end === block.end && otherBlock.start < block.start)
|
||||
)
|
||||
) {
|
||||
return false; // Overlapping 'p' block found, filter it out
|
||||
|
Loading…
x
Reference in New Issue
Block a user