@@ -1609,18 +1609,23 @@ function mdastToPlainText(root) {
16091609 out += s ;
16101610 } ;
16111611 visit ( root , ( node2 ) => {
1612- if ( node2 . type === "code" || node2 . type === "inlineCode" ) {
1612+ if ( node2 . type === "code" || node2 . type === "inlineCode" ) return SKIP ;
1613+ if ( node2 . type === "paragraph" && / % % R E S I S T / . test ( toString ( node2 ) ) ) return SKIP ;
1614+ if ( node2 . type === "heading" ) {
1615+ push ( toString ( node2 ) ) ;
16131616 return SKIP ;
16141617 }
1615- if ( node2 . type === "paragraph" && / % % R E S I S T / . test ( toString ( node2 ) ) ) {
1616- return SKIP ;
1618+ if ( node2 . type === "mdxJsxFlowElement" || node2 . type === "mdxJsxTextElement" ) {
1619+ const name = node2 . name ?. toLowerCase ?. ( ) ;
1620+ if ( name && ( / ^ h [ 1 - 6 ] $ / . test ( name ) || name . includes ( "heading" ) ) ) {
1621+ push ( toString ( node2 ) ) ;
1622+ return SKIP ;
1623+ }
16171624 }
16181625 if ( node2 . type === "text" ) {
16191626 push ( node2 . value ) ;
16201627 }
1621- if ( node2 . type === "break" ) {
1622- out += " " ;
1623- }
1628+ if ( node2 . type === "break" ) out += " " ;
16241629 } ) ;
16251630 const compact = out . replace ( / \s + / g, " " ) . trim ( ) ;
16261631 return ` ${ compact } ` ;
@@ -1688,25 +1693,52 @@ function remarkResistogram(options) {
16881693 const { resolved : organismIds , unresolved : unresolvedOrg } = resolveIds ( orgParam , sharedData . allOrgIds , sharedData . orgSyn2Id , pageText ) ;
16891694 const selectedSource = selectDataSource ( params . source , sharedData . sources ) ;
16901695 const logWarning = ( message ) => {
1691- console . warn ( import_chalk . default . yellow ( `[docusaurus-plugin-resistogram] Warning in ${ file . path } :
1696+ console . warn (
1697+ import_chalk . default . yellow ( `[docusaurus-plugin-resistogram] Warning in ${ file . path } :
16921698${ message }
1693- ` ) ) ;
1699+ ` )
1700+ ) ;
16941701 } ;
1702+ const autoInfo = [ ] ;
1703+ if ( abxParam === "auto" ) {
1704+ autoInfo . push ( "antibiotics=auto \u2192 resolved against page text" ) ;
1705+ }
1706+ if ( orgParam === "auto" ) {
1707+ autoInfo . push ( "organisms=auto \u2192 resolved against page text" ) ;
1708+ }
16951709 if ( unresolvedAbx . length > 0 || unresolvedOrg . length > 0 ) {
16961710 const unresolved = [ ...unresolvedAbx , ...unresolvedOrg ] ;
1697- logWarning ( `Unrecognized identifiers in "%%RESIST ${ paramsStr } %%": ${ unresolved . join ( ", " ) } .
1698- The table will display an error.` ) ;
1711+ logWarning (
1712+ `Unrecognized identifiers in "%%RESIST ${ paramsStr } %%": ${ unresolved . join (
1713+ ", "
1714+ ) } .
1715+ Resolved antibiotics: ${ JSON . stringify ( antibioticIds ) } .
1716+ Resolved organisms: ${ JSON . stringify ( organismIds ) } .
1717+ ${ autoInfo . length ? "Parameter mode: " + autoInfo . join ( "; " ) : "" } `
1718+ ) ;
16991719 } else if ( antibioticIds . length === 0 || organismIds . length === 0 ) {
1700- logWarning ( `The directive "%%RESIST ${ paramsStr } %%" did not resolve to any valid antibiotics or organisms.
1701- The table will be empty.` ) ;
1720+ logWarning (
1721+ `The directive "%%RESIST ${ paramsStr } %%" did not resolve to any valid antibiotics or organisms.
1722+ Resolved antibiotics: ${ JSON . stringify ( antibioticIds ) } .
1723+ Resolved organisms: ${ JSON . stringify ( organismIds ) } .
1724+ ${ autoInfo . length ? "Parameter mode: " + autoInfo . join ( "; " ) : "" } `
1725+ ) ;
17021726 } else {
1703- const resistanceData = await loadResistanceDataForSource ( selectedSource , sharedData . sources , dataPath ) ;
1727+ const resistanceData = await loadResistanceDataForSource (
1728+ selectedSource ,
1729+ sharedData . sources ,
1730+ dataPath
1731+ ) ;
17041732 const hasData = resistanceData . some (
17051733 ( row ) => antibioticIds . includes ( row . antibiotic_id ) && organismIds . includes ( row . organism_id )
17061734 ) ;
17071735 if ( ! hasData ) {
1708- logWarning ( `No resistance data found for the combination of resolved antibiotics and organisms in "%%RESIST ${ paramsStr } %%".
1709- The table will be empty.` ) ;
1736+ logWarning (
1737+ `No resistance data found for the combination in "%%RESIST ${ paramsStr } %%".
1738+ Resolved antibiotics: ${ JSON . stringify ( antibioticIds ) } .
1739+ Resolved organisms: ${ JSON . stringify ( organismIds ) } .
1740+ ${ autoInfo . length ? "Parameter mode: " + autoInfo . join ( "; " ) : "" } `
1741+ ) ;
17101742 }
17111743 }
17121744 const resistogramNode = {
0 commit comments